04 2014 档案
摘要:索引是一种数据结构,一般采用B-tree、R-tree或者Hash结构,R-tree常用来查询比较接近的数据,B-tree用来查找范围的数据,能够很快的从当前数据查找到下条数据;hash常用来查询随机访问的数据,查询每条数据的时间几乎相同。对于查找一段时间范围内的数据采用b-树就比hash快。B-t...
阅读全文
摘要:Spring是一个轻量级的框架,他有自己的MVC框架SpringMVC,在以往的Web项目中大多采用Structs2+hibernate+Spring的框架,Structs做web层,Hibernate做数据持久化层,Spring做model层(包括DAO,Service)。在这些框架中往往可以只采
阅读全文
摘要:这道题也太简单了吧,可能我的方法不够简单1 public class Solution {2 public int search(int[] A, int target) {3 for(int i=0;i<A.length;i++){4 if(A[i]==target)5 return i;6 }7 return -1;8 }9 }
阅读全文
摘要:做这道题的时候很纠结,下面这个程序能够AC, 1 int n=A.length; 2 int i=0,j=0,cnt=0; 3 if(n==0||n==1) return n; 4 for(i=0;i=2){ 9 cnt++;10 }else if(A[i]!=A[i+1]&&cnt=2){14 cnt=0;15 }16 17 }18 if(A[n-1]!=A[n-2]||A[n...
阅读全文
摘要:有二叉树的前序遍历和后序遍历,构造二叉树/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { public TreeNode buildTree(int[] preorder, int[] inorder) { HashMap map = new HashMap (); f...
阅读全文