<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"><channel><title>MagicLen</title><link>https://magiclen.org/tag/sorting-algorithm/feed</link><description>多元化原創文章，內容包羅萬象，有程式語言、網站應用、軟體介紹、硬體介紹、作業系統、旅行遊記、專題採訪、益智問題、文學創作，以及作者們的知識分享和作品分享。</description><language>zh-TW</language><lastBuildDate>Tue, 21 Apr 2026 13:21:29 +0000</lastBuildDate><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>8</sy:updateFrequency><sy:updateBase>1970-01-01T00:00+00:00</sy:updateBase><item><title>基數排序(Radix Sort)演算法，可以依據多個鍵值來排序的演算法</title><link>https://magiclen.org/radix-sort</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png 1x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-440x324.png 2x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-660x486.png 3x" alt="">
基數排序(Radix Sort)演算法是可以利用多個鍵值來排序資料的演算法。排序還需要多個鍵值？有時候當然會需要啦！像是要排序檔案時，可以先依照檔案名稱排序後，再依照檔案大小來排，如此一來，整體上來看這些檔案，會是以檔案大小來排序，而相同檔案大小的檔案則是會依照檔案名稱來排序。基數排序法可以將整數的各個位數當作是鍵值，來進行線性時間的排序，比起會依照k(要排序的資料可能的值的數量)愈大而愈吃空間的...]]></description><category>研究分享</category><category>Java</category><category>Rust</category><category>演算法</category><category>Go</category><category>JavaScript</category><category>Java</category><category>JavaScript</category><category>排序演算法</category><category>Rust</category><category>基數排序</category><category>TypeScript</category><category>Go</category><guid>https://magiclen.org/radix-sort</guid><pubDate>Thu, 30 May 2019 20:00:25 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>桶排序(Bucket Sort)演算法，利用運算式將資料分類、排序後，再合併起來的排序演算法</title><link>https://magiclen.org/bucket-sort</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png 1x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-440x324.png 2x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-660x486.png 3x" alt="">
桶排序(Bucket Sort)演算法是先將大量資料分類成少量資料後，再進行排序的演算法。可以透過簡單的運算式來完成資料的分類，在最好的情況之下，資料可以被完全打散，此時的時間複雜度就會是一個線性時間。]]></description><category>研究分享</category><category>Java</category><category>Rust</category><category>演算法</category><category>Go</category><category>JavaScript</category><category>Java</category><category>JavaScript</category><category>排序演算法</category><category>Rust</category><category>桶排序</category><category>TypeScript</category><category>Go</category><guid>https://magiclen.org/bucket-sort</guid><pubDate>Sun, 26 May 2019 12:00:30 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>堆積排序(Heap Sort)演算法，利用完全二元樹來排序的演算法</title><link>https://magiclen.org/heap-sort</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png 1x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-440x324.png 2x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-660x486.png 3x" alt="">
堆積排序(Heap Sort)演算法是利用完全二元樹(Complete Binary Tree)，也就是堆積(Heap)結構來完成排序的演算法。雖然說要用到堆積結構，看起來好像很複雜似的，但其實這個只要一般的陣列結構(可以直接用要排序的陣列來製作)就能實作出來，而且實作出來的速度保證不會太慢，再怎麼差都會有O(nlogn)的時間複雜度。]]></description><category>研究分享</category><category>Java</category><category>Rust</category><category>演算法</category><category>Go</category><category>JavaScript</category><category>Java</category><category>JavaScript</category><category>排序演算法</category><category>Rust</category><category>堆積排序</category><category>TypeScript</category><category>Go</category><guid>https://magiclen.org/heap-sort</guid><pubDate>Fri, 5 Apr 2019 20:00:45 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>合併排序(Merge Sort)演算法，穩定、快速的排序演算法</title><link>https://magiclen.org/merge-sort</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png 1x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-440x324.png 2x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-660x486.png 3x" alt="">
合併排序(Merge Sort)演算法是非常通用的排序演算法，是穩定排序，即便在最差的情況下也還有O(nlogn)的時間複雜度。]]></description><category>研究分享</category><category>Java</category><category>Rust</category><category>演算法</category><category>Go</category><category>JavaScript</category><category>Java</category><category>JavaScript</category><category>排序演算法</category><category>合併排序</category><category>Rust</category><category>TypeScript</category><category>Go</category><guid>https://magiclen.org/merge-sort</guid><pubDate>Fri, 5 Apr 2019 18:00:28 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>希爾排序(Shell Sort)演算法，改良的插入排序法</title><link>https://magiclen.org/shell-sort</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png 1x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-440x324.png 2x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-660x486.png 3x" alt="">
希爾排序(Shell Sort)演算法是插入排序(Insertion Sort)演算法的改良版。它解決了插入排序法一次只能把元素移動一個索引距離的問題，加入間距(gap)的概念來分批並分組完成插入排序法，有效提升原本插入排序法的速度。]]></description><category>研究分享</category><category>Java</category><category>Rust</category><category>演算法</category><category>Go</category><category>JavaScript</category><category>Java</category><category>JavaScript</category><category>排序演算法</category><category>插入排序</category><category>Rust</category><category>希爾排序</category><category>TypeScript</category><category>Go</category><guid>https://magiclen.org/shell-sort</guid><pubDate>Fri, 5 Apr 2019 16:00:52 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>雞尾酒排序(Cocktail Sort)演算法，雙向的氣泡排序法</title><link>https://magiclen.org/cocktail-sort</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png 1x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-440x324.png 2x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-660x486.png 3x" alt="">
雞尾酒排序(Cocktail Sort)演算法又稱為搖晃排序(Shaker Sort)演算法、雙向氣泡排序(Bidirectional Bubble Sort)演算法，顧名思義，它是氣泡排序(Bubble Sort)演算法的變體，將原本單向走訪的氣泡排序改為雙向，用以解決使用氣泡排序法時，序列中未排序的一端其實已經大致排序好，卻又不能儘快把它完成的情形。]]></description><category>研究分享</category><category>Java</category><category>Rust</category><category>演算法</category><category>Go</category><category>JavaScript</category><category>Java</category><category>JavaScript</category><category>排序演算法</category><category>氣泡排序</category><category>Rust</category><category>雞尾酒排序</category><category>TypeScript</category><category>Go</category><guid>https://magiclen.org/cocktail-sort</guid><pubDate>Fri, 5 Apr 2019 14:00:24 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>插入排序(Insertion Sort)演算法，一邊將元素加進序列、一邊進行排序的演算法</title><link>https://magiclen.org/insertion-sort</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png 1x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-440x324.png 2x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-660x486.png 3x" alt="">
插入排序(Insertion Sort)演算法，是基本的排序演算法，是學習程式語言最先需要學會的排序演算法之一。插入排序法的用途廣泛，除了可以用來將新元素添加到已存在且已排序好的序列並維持其排序外，還可以用來排序尚未排序的序列。而且其排序結果是穩定的。]]></description><category>研究分享</category><category>Java</category><category>Rust</category><category>演算法</category><category>Go</category><category>JavaScript</category><category>Java</category><category>JavaScript</category><category>排序演算法</category><category>插入排序</category><category>Rust</category><category>TypeScript</category><category>Go</category><guid>https://magiclen.org/insertion-sort</guid><pubDate>Fri, 5 Apr 2019 12:00:06 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>氣泡排序法(Bubble Sort)演算法，容易實作的穩定排序演算法</title><link>https://magiclen.org/bubble-sort</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png 1x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-440x324.png 2x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-660x486.png 3x" alt="">
氣泡排序(Selection Sort)演算法又稱為泡沫排序演算法，是基本的排序演算法，是學習程式語言最先需要學會的排序演算法之一。顧名思義，就是它的排序方式如同氣泡一般，不斷將最大的元素擠出(移動)到序列最尾端，當所有元素都被被擠出後，排序就完成了！而且排序結果是穩定的。]]></description><category>研究分享</category><category>Java</category><category>Rust</category><category>演算法</category><category>Go</category><category>JavaScript</category><category>Java</category><category>JavaScript</category><category>排序演算法</category><category>氣泡排序</category><category>Rust</category><category>TypeScript</category><category>Go</category><guid>https://magiclen.org/bubble-sort</guid><pubDate>Fri, 5 Apr 2019 10:00:26 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>選擇排序(Selection Sort)演算法，最簡單的排序演算法</title><link>https://magiclen.org/selection-sort</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png 1x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-440x324.png 2x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-660x486.png 3x" alt="">
選擇排序(Selection Sort)演算法是最基本的排序演算法，是學習程式語言最先需要學會的排序演算法之一。它可以按照元素值的大小序次，一一將最小值、第二小值等等的元素排入序列中的正確索引位置內。]]></description><category>研究分享</category><category>Java</category><category>Rust</category><category>演算法</category><category>Go</category><category>JavaScript</category><category>Java</category><category>JavaScript</category><category>排序演算法</category><category>交換排序</category><category>選擇排序</category><category>Rust</category><category>TypeScript</category><category>Go</category><guid>https://magiclen.org/selection-sort</guid><pubDate>Fri, 5 Apr 2019 08:00:02 +0800</pubDate><dc:creator>Magic Len</dc:creator></item><item><title>快速排序(Quick Sort)演算法，瞬間就可以排好超大序列！</title><link>https://magiclen.org/quick-sort</link><description><![CDATA[    <img src="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-220x162.png 1x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-440x324.png 2x, https://magiclen.org/wp-content/uploads/2016/05/1463382782_icon_23_one_finger_double_tap-660x486.png 3x" alt="">
快速排序(Quick Sort)演算法又稱為劃分交換排序(Partition-Exchange Sort)演算法，是實用性很高的排序演算法，它可以在O(nlogn)的時間複雜度完成排序，雖然是不穩定排序，但它的速度完全可以彌補這個缺點。]]></description><category>研究分享</category><category>Java</category><category>Rust</category><category>演算法</category><category>Go</category><category>JavaScript</category><category>Java</category><category>JavaScript</category><category>排序演算法</category><category>快速排序</category><category>Rust</category><category>TypeScript</category><category>Go</category><guid>https://magiclen.org/quick-sort</guid><pubDate>Thu, 4 Apr 2019 18:50:22 +0800</pubDate><dc:creator>Magic Len</dc:creator></item></channel></rss>