自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(51)
  • 收藏
  • 关注

转载 【数据库】SQL 优化原则(转)

一、问题的提出 在应用系统开发初期,由于开发数据库数据比较少,对于查询SQL语句,复杂视图的的编写等体会不出SQL语句各种写法的性能优劣,但是如果将应用系统提交实际应用后,随着数据库中数据的增加,系统的响应速度就成为目前系统需要解决的最主要的问题之一。系统优化中一个很重要的方面就是SQL语句的优化。对于海量数据,劣质SQL语句和优质SQL语句之间的速度差别可以达到上百倍,可见对于一个系统不是简单地能

2016-04-21 08:48:32 478

转载 【JAVA】JVM垃圾回收(GC)原理(转)

一、相关概念 基本回收算法 引用计数(Reference Counting) 比较古老的回收算法。原理是此对象有一个引用,即增加一个计数,删除一个引用则减少一个计数。垃圾回收时,只用收集计数为0的对象。此算法最致命的是无法处理循环引用的问题。 标记-清除(Mark-Sweep) 此算法执行分两阶段。第一阶段从引用根节点开始标记所有被引用的对象,第二阶段遍历整个堆,把未标记的对象清除。此算

2016-03-30 15:30:24 487

原创 【LeetCode】206. Reverse Linked List

Question: Reverse a singly linked list. Hint: A linked list can be reversed either iteratively or recursively. Could you implement both?My solution (recursion): 1ms/** * Definition for sing

2016-03-25 14:15:35 808

原创 【Leetcode】100. Same Tree

Question: Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same valu

2016-03-25 13:20:50 355

原创 【LeetCode】226. Invert Binary Tree

Question:Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Solution:My solution (No recursion):1ms/** * Definition for a binary tre

2016-03-24 15:04:32 372

转载 【JAVA】Java集合类: Set、List、Map、Queue使用场景梳理

本文主要关注Java编程中涉及到的各种集合类,以及它们的使用场景 相关学习资料http://files.cnblogs.com/LittleHann/java%E9%9B%86%E5%90%88%E6%8E%92%E5%BA%8F%E5%8F%8Ajava%E9%9B%86%E5%90%88%E7%B1%BB%E8%AF%A6%E8%A7%A3%28collection%E3%80%81list%

2016-03-24 11:36:13 726

转载 【JAVA】递归调用(转)

public class Recursion { public static void main(String[] args) { // TODO 自动生成方法存根 int car=15000; int i=1; System.out.print(recursion(car,i)

2016-03-24 11:07:34 650

原创 【LeetCode】104. Maximum Depth of Binary Tree

Question: Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Solution:My solution:3ms/**

2016-03-24 11:02:06 263

转载 【Oracle】Oracle交集、并集、差集的运算

1.并集的运算select name from test1union [all]select name from test2;使用union时,默认将对结果进行排序,union all则不进行排序操作,所以会消耗更少的资源;然而,union all将不进行去重的操作~2.交集的运算select name from test1intersect

2016-03-23 13:32:10 628

原创 【Oracle】merge into使用方法

/*Merge into 详细介绍 MERGE语句是Oracle9i新增的语法,用来合并UPDATE和INSERT语句。 通过MERGE语句,根据一张表或子查询的连接条件对另外一张表进行查询, 连接条件匹配上的进行UPDATE,无法匹配的执行INSERT。 这个语法仅需要一次全表扫描就完成了全部工作,执行效率要高于INSERT+UPDATE。 */ /*语法: MERGE [INTO

2016-03-22 13:51:28 564

转载 【存储过程】在java语言中调用存储函数

连接oracle数据库 private static Connection conn; static{ //第一步:加载驱动 try { Class.forName("oracle.jdbc.driver.OracleDriver"); //得到连接对象

2016-03-21 14:57:08 274

转载 【存储过程】 在java语言中调用存储过程

首先一定要连接数据库啊 private static Connection conn; static{ //第一步:加载驱动 try { Class.forName("oracle.jdbc.driver.OracleDriver"); //得到连接对象

2016-03-21 14:56:02 384

转载 【存储过程】利用包构建存储过程和存储函数的案例(转)

存储过程: 包 create or replace package emppackage is -- Author : ADMINISTRATOR -- Created : 2012-3-22 14:02:43 -- Purpose : 声明一个存储过程 -- Public type declarations type empcursor is r

2016-03-21 14:54:29 413

原创 【JAVA】PL/SQL连接:ORA-12154:TNS:无法解析指定的连接标识符

今天用pl/sql时出现一个问题,本是可以连接的一个数据库,在添加了一个数据库配置以后,就出现了“ORA-12154:TNS:无法解析指定的连接标识符”的问题。网上查了这个问题的解决办法。先贴一部分: pl/sql 每当oracle client中service name发生变化,都会按照client安装目录下最新的tnsnames.ora,去作为它的读取文件;如果该文件在卸载oracle cli

2016-03-21 11:52:51 705

原创 【JAVA】存储过程学习之路1(Oracle)

因最近项目的需要,本想通过直接用Jdbc来进行大批量数据的查询以及插入,后来通过实际操作发现,还是太慢,所需时间太长,即使用executeBatch()也太慢了。于是昨天花一下午的时间,通过看教学视频和文档,了解了存储过程的应用。通过今天一上午的改编,成功将Jdbc的存取批量数据操作改成存储过程的调用操作,经检验,存储过程着实要比直接用Jdbc调用快的多。 而初次使用存储过程,遇到了一些小问题,并

2016-03-18 10:48:42 339

转载 【JAVA】调用存储过程(详细)

在Java中调用存储过程(详细) 本文阐述了怎么使用DBMS存储过程。我阐述了使用存储过程的基本的和高级特性,比如返回ResultSet。本文假设你对DBMS和JDBC已经非常熟悉,也假设你能够毫无障碍地阅读其它语言写成的代码(即不是Java的语言),但是,并不要求你有任何存储过程的编程经历。 存储过程是指保存在数据库并在数据库端执行的程序。你可以使用特殊的语法在Java类中调用存储过程。在调

2016-03-18 10:15:22 370

原创 【JAVA】oracle批量插入数据操作

最近做的项目需要将大批量数据插入到数据库中,之前有印象用preparedstatement.executeBatch();来做,这样可以减少与数据库间的交互;今天上网查找了具体怎么实现,发现不仅仅只是单纯用addBatch()和executeBatch()就行了,还需要将conn.setAutoCommit(false),这样关闭自动事务提交,也可以减少交互。还需注意addBatch()到一定次数是

2016-03-17 12:23:25 8993

转载 鼠标聚焦到TextBox输入框时,按回车键刷新页面原因及解决方法

问题:鼠标聚焦到TextBox输入框时,按回车键刷新页面原因:当<form></form> 中只有一个TextBox输入框时,当输入完成后,按回车键会自动提交,便刷新了页面解决方法:1、处理form 在form中添加事件 <form onsubmit="return false;">.......</form>2、增加一个隐藏的输入框,认为改变单个输入框<input id="hiddenText"

2016-01-07 14:48:38 793

原创 【LeetCode】172. Factorial Trailing Zeroes

Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.Method 2 is original by myself. It is very close to Method 1, i need think mo

2015-12-19 18:24:08 331

原创 【LeetCode】67 Add Binary

Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”.Summary: Array[i] is faster than String.charAt(int i);Method 1 : (4ms)public class S

2015-12-04 17:59:29 381

原创 【LeetCode】219 Contains Duplicate II

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k.public clas

2015-12-04 16:28:27 275

原创 【LeetCode】88 Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional

2015-12-03 17:06:24 230

原创 【LeetCode】119 Pascal's Triangle II

Pascal’s TriangleGiven an index k, return the kth row of the Pascal’s triangle.For example, given k = 3, Return [1,3,3,1].Note: Could you optimize your algorithm to use only O(k) extra space?Method 1

2015-12-03 13:58:21 333

原创 【LeetCode】118 Pascal's Triangle

Given numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ]public class Solution { pub

2015-12-03 10:49:18 225

原创 【LeetCode】27 Remove Element

Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn’t matter what you leave beyond the new length.Method 1:(

2015-12-03 09:49:03 229

原创 【LeetCode】190 Reverse Bits

Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110

2015-12-03 09:45:23 237

原创 【LeetCode】190 Reverse Bits

Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110

2015-12-02 14:37:44 217

原创 【LeetCode】189 Rotate Array

Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Congradulation! My runtime beats 98.27% of java submissi

2015-12-02 13:21:14 227

原创 【LeetCode】66 Plus One

Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.题意:给定一个非负整数用数组形式表示,最高位在数组下标最低

2015-12-02 09:27:03 233

原创 【LeetCode】26 Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with cons

2015-12-01 18:13:37 263

原创 【LeetCode】228 Summary Ranges

Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return [“0->2”,”4->5”,”7”].public class Solution { public List<String> summaryRan

2015-12-01 17:39:55 209

原创 【LeetCode】231 Power of Two

Given an integer, write a function to determine if it is a power of two.思路: 求是否是2的幂,由2可以联想到2进制,只要数的2进制表示中只含有一个值为1的bit位,这个数即是2的幂。 法2用Integer.bitCount(int i)方法,该方法虽然只需一行即可解决问题,但是所需的时间却比自己写的法1更多

2015-12-01 17:11:48 310

原创 【LeetCode】231 Power of Two

Given an integer, write a function to determine if it is a power of two.思路: 求是否是2的幂,由2可以联想到2进制,只要数的2进制表示中只含有一个值为1的bit位,这个数即是2的幂。 法2用Integer.bitCount(int i)方法,该方法虽然只需一行即可解决问题,但是所需的时间却比自己写的法1更多

2015-12-01 17:11:20 199

原创 【LeetCode】202 Happy Number

Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares

2015-12-01 16:12:47 265

原创 【LeetCode】263 Ugly Number

Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it in

2015-12-01 14:37:53 225

原创 【LeetCode】70 Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?public class Solution { public in

2015-12-01 13:59:31 222

原创 【LeetCode】13 Roman to Integer

Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.public class Solution { public int romanToInt(String s) { char[] arrs = s.toCharArr

2015-12-01 13:50:46 227

原创 【LeetCode】191 Number of 1 Bits

Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ has binary representation 0000000000000

2015-12-01 13:42:21 242

原创 【LeetCode】169 Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element always

2015-12-01 13:37:57 288

原创 【LeetCode】171 Excel Sheet Column Number

Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example:A -> 1B -> 2C -> 3...Z -> 26AA -> 27AB -> 28 publ

2015-12-01 13:36:17 254

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除