摘要: #includeint a[20],n;int lowbit(int x){ return x&(-x);}void add(int x,int c){ int i; for(i=x; iint a[50],n;int lowbit(int x){ return x&(-x)... 阅读全文
posted @ 2014-07-21 22:02 CodeNoob 阅读(179) 评论(0) 推荐(0) 编辑
摘要: In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacen... 阅读全文
posted @ 2014-07-21 21:49 CodeNoob 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 今天学了一下树状数组。如果给定一个数组,要你求里面所有数的和,一般都会想到累加。但是当那个数组很大的时候,累加就显得太耗时了,时间复杂度为O(n),并且采用累加的方法 还有一个局限,那就是,当修改掉数组中的元素后,仍然要你求数组中某段元素的和,就显得麻烦了。所以我们就要用到树状数组,他的时间复杂度为... 阅读全文
posted @ 2014-07-21 21:26 CodeNoob 阅读(132) 评论(0) 推荐(0) 编辑