#5722: 排序法的速度


stanley17112000 (Stanley)


我發現了重大的秘密!!!!

這題用合併排序法比快速排序法快!!!!  ><

#6253: Re:排序法的速度


J99 (J)


我發現了重大的秘密!!!!

這題用合併排序法比快速排序法快!!!!  ><


It is because qsort has poor time complexity O(n2) for partially sorted data.
But using merge sort for  partially sorted data has best time complexity O(n).
#6255: Re:排序法的速度


david942j (文旋)


我發現了重大的秘密!!!!

這題用合併排序法比快速排序法快!!!!  ><


It is because qsort has poor time complexity O(n2) for partially sorted data.
But using merge sort for  partially sorted data has best time complexity O(n).

樓上..mergesort's complexity is always O(nlgn) no matter what data is ...
#26636: Re:排序法的速度


s1082951 (Amadeus)


我發現了重大的秘密!!!!

這題用合併排序法比快速排序法快!!!!  ><


It is because qsort has poor time complexity O(n2) for partially sorted data.
But using merge sort for  partially sorted data has best time complexity O(n).


.排序法最低只能到 nlogn吧