Overview of Common Sorting Algorithms and Their Characteristics
This article introduces sorting algorithms, distinguishing internal and external sorting, listing major internal sorts, explaining their time‑complexity categories and stability properties, and providing visual illustrations for each algorithm along with a reference to an open‑source implementation.
Sorting algorithms are one of the most basic algorithms in data structures and algorithms, essential for ordering data.
Sorting can be divided into internal sorting, which operates on data stored in memory, and external sorting, which handles data too large to fit in memory and thus requires access to external storage.
Common internal sorting algorithms include insertion sort, shell sort, selection sort, bubble sort, merge sort, quick sort, heap sort, and radix sort.
Time‑complexity categories are: O(n²) for simple sorts such as insertion, selection, and bubble sort; O(n·log²n) for quick sort, heap sort, and merge sort; O(n^{1+δ}) (δ between 0 and 1) for shell sort; and O(n) for linear‑time sorts like radix sort, bucket sort, and counting sort.
Regarding stability, stable sorting algorithms are bubble sort, insertion sort, merge sort, and radix sort, while selection sort, quick sort, shell sort, and heap sort are not stable.
The article then presents visual illustrations for each algorithm—bubble sort, selection sort, insertion sort, shell sort, merge sort, quick sort, heap sort, counting sort, bucket sort, and radix sort—showing their step‑by‑step processes.
For readers interested in the source code, the open‑source project is available at https://github.com/hustcc/JS-Sorting-Algorithm , curated by hustcc.
Finally, the author invites readers to like and share the content if they find it helpful.
Java Captain
Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.