05 2016 档案

摘要://maximum and minimum 暴力遍历 O(n) //i-th element dicide and conquer random_selected_partition k(all the element samller than value[k] put left of value[ 阅读全文
posted @ 2016-05-08 11:34 zeroArn 阅读(130) 评论(0) 推荐(0)
摘要://intput array A,output array result. count array count . //all the elements is in te range of 0~k. //if k=O(n),the complexity is Θ(n) //counting sort 阅读全文
posted @ 2016-05-07 21:36 zeroArn 阅读(128) 评论(0) 推荐(0)
摘要://max_heap heap_maximum:return A[1] O(1); Extract_Heap_maximum:swap(A[1],A[heap.size]) adjust up to down from A[1] to hold the max_heap character O(lg 阅读全文
posted @ 2016-05-06 15:58 zeroArn 阅读(196) 评论(0) 推荐(0)
摘要://用满二叉树存储,从n/2处开始递归向上调整(n/2后均为叶子节点,无需调整)使得根最大 //满二叉树顺序存储,左子2i,右子2i+1; #include<stdio.h>#include<stdlib.h>#include<time.h>#define ARRAY_SIZE 1000#defin 阅读全文
posted @ 2016-05-06 00:41 zeroArn 阅读(181) 评论(0) 推荐(0)
摘要://the first k elements interviewed and rejected, //for the latter n-k elements ,if value >max,return value, else return n'elements. #include<stdio.h># 阅读全文
posted @ 2016-05-05 16:37 zeroArn 阅读(123) 评论(0) 推荐(0)
摘要:T(n)=aT(n/b)+f(n); where we can interpret n/b to mean either floor(b/n) or ceil(b/n), Then T (n) has the following asymptotic bounds: 1. If f (n)= O(n 阅读全文
posted @ 2016-05-05 15:07 zeroArn 阅读(178) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<stdlib.h>#include<time.h>#define ARRAY_SIZE 1000int buf [ARRAY_SIZE];int main(){ srand((unsigned int )time(0)); int i,j,n; w 阅读全文
posted @ 2016-05-04 17:02 zeroArn 阅读(170) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<string.h>#include<stdlib.h>#include<time.h>#define ARRAY_SIZE 1000int buf[ARRAY_SIZE];int main(){ int i,j,n; srand((unsigned 阅读全文
posted @ 2016-05-03 20:59 zeroArn 阅读(106) 评论(0) 推荐(0)
摘要:macro is typeless and execute faster than funtion ,becaus of the overhead of calling and returnning of function,but macro will increase the size of pr 阅读全文
posted @ 2016-05-02 11:45 zeroArn 阅读(173) 评论(0) 推荐(0)