鎺掑簭绠楁硶

鍗佸ぇ缁忓吀鎺掑簭绠楁硶
https://www.cnblogs.com/onepixel/p/7674659.html
蹇熸帓搴忎唬鐮佺ず渚
https://shimo.im/docs/98KjvGwwGpTpYGKy/
褰掑苟鎺掑簭浠g爜绀轰緥
https://shimo.im/docs/YqgG6vtdKwkXJkWx/
鍫嗘帓搴忎唬鐮佺ず渚
https://shimo.im/docs/6kRVHRphpgjHgCtx/

鎺掑簭绠楁硶

姣旇緝绫绘帓搴

闈炴瘮杈冩帓搴

鎺掑簭鏂规硶 鏃堕棿澶嶆潅搴(骞冲潎) 鏃堕棿澶嶆潅搴(鏈鍧) 鏃堕棿澶嶆潅搴(鏈濂) 绌洪棿澶嶆潅搴 绋冲畾鎬
鎻掑叆鎺掑簭 O(n^2) O(n^2) O(n) O(1) 绋冲畾
甯屽皵鎺掑簭 O(n^1.3) O(n^2) O(n) O(1) 涓嶇ǔ瀹
閫夋嫨鎺掑簭 O(n^2) O(n^2) O(n^2) O(1) 涓嶇ǔ瀹
鍫嗘帓搴 O(nlog2n) O(nlog2n) O(nlog2n) O(1) 涓嶇ǔ瀹
鍐掓场鎺掑簭 O(n^2) O(n^2) O(n) O(1) 绋冲畾
蹇熸帓搴 O(nlog2n) O(n^2) O(nlog2n) O(nlog2n) 涓嶇ǔ瀹
褰掑苟鎺掑簭 O(nlog2n) O(nlog2n) O(nlog2n) O(n) 绋冲畾
璁℃暟鎺掑簭 O(n+k) O(n+k) O(n+k) O(n+k) 绋冲畾
妗舵帓搴 O(n+k) O(n^2) O(n) O(n+k) 绋冲畾
鍩烘暟鎺掑簭 O(n*k) O(n*k) O(n*k) O(n+k) 绋冲畾

log2n 鐨勬帓搴忔柟娉曢渶瑕侀噸鐐规帉鎻
蹇燂紝褰掑苟鎺掑簭鐢ㄥ埌浜嗗垎娌荤殑鎬濇兂銆

鍒濈骇鎺掑簭 – O(n^2)

  1. 閫夋嫨鎺掑簭(Selection Sort)

    姣忔鎵炬渶灏忓,鐒跺悗鏀惧埌寰呮帓搴忔暟缁勭殑璧峰浣嶇疆銆

  2. 鎻掑叆鎺掑簭(Insertion Sort)

    浠庡墠鍒板悗閫愭鏋勫缓鏈夊簭搴忓垪;瀵逛簬鏈帓搴忔暟鎹紝鍦ㄥ凡鎺掑簭搴忓垪涓粠鍚庡悜鍓嶆壂鎻忥紝鎵惧埌鐩稿簲浣嶇疆骞舵彃鍏ャ

  3. 鍐掓场鎺掑簭(Bubble Sort)

    宓屽寰幆锛屾瘡娆℃煡鐪嬬浉閭诲厓绱狅紝濡傛灉閫嗗簭锛屽垯浜ゆ崲銆傛瘡娆″啋娉★紝鏈澶х殑鍏冪礌閮戒細琚尓鍒板悗闈紝鍏跺疄鍜岄夋嫨鎺掑簭鏄浉閫嗙殑銆

楂樼骇鎺掑簭 – O(N*logN)

….

All posts

Other pages

鍙戣〃璇勮

閭鍦板潃涓嶄細琚叕寮銆 蹇呭~椤瑰凡鐢*鏍囨敞