摘要: 1. 对于堆, 结点I的左子2*i +1 右子2*i + 22. 对于n的堆, 第一个非叶子结点是n/2 - 1, 考虑到数组是从0开始的, 最后一个结点是n-1, 第一个是03. 删除和添加是在AdjustHeap()的基础上实现的#includevoid swap(int *a, int *b)... 阅读全文
posted @ 2014-03-18 22:28 海滨银枪小霸王 阅读(125) 评论(0) 推荐(0)
摘要: 实现两位数精度#includedouble sqrtss(double src){ double mid,low,high; low = 0.0; if(src>1.0) high = src; else high = 1.0 ; mid... 阅读全文
posted @ 2014-03-18 17:38 海滨银枪小霸王 阅读(176) 评论(0) 推荐(0)
摘要: There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ... 阅读全文
posted @ 2014-03-18 10:46 海滨银枪小霸王 阅读(112) 评论(0) 推荐(0)