比較 N個元素 一個一個地插入到一個堆中 以線性時間創建一個堆 已排序、反序、隨機輸入的運行時間

《數據結構與算法分析——c語言描述》 練習6.11 答案算法 性能居然相差兩倍。buildheap複雜度是O(N),n次insert是O(NlogN)數據結構 #include"binheap.h" #include<stdlib.h> #include<stdio.h> #include<time.h> #define N 9999999 int RandInt(int i, int j) {
相關文章
相關標籤/搜索