Skip to content

A GitBook online book on sorting algorithms "Top Ten Classic Sorting Algorithms", implemented in multiple languages.

Notifications You must be signed in to change notification settings

thisisharsh7/JS-Sorting-Algorithm

 
 

Repository files navigation

Top 10 Classic Sorting Algorithms

The sorting algorithm is one of the most basic algorithms in Data Structures and Algorithms.

Sorting algorithms can be divided into internal sorting and external sorting. Internal sorting is the sorting of data records in memory, while external sorting is because the data to be sorted is large and cannot accommodate all sorting records at one time, and external memory needs to be accessed during the sorting process. Common internal sorting algorithms are: insertion sort, Hill sort, selection sort, bubble sort, merge sort, quick sort, heap sort, radix sort and so on. Summarize with a picture:

Top Ten Classic Sorting Algorithms Overview Screenshot

About time complexity:

  1. Square order (O(n2)) sorting Various simple sorts: direct insertion, direct selection, and bubble sort.
  2. Linear logarithmic (O(nlog2n)) sorting Quick sort, heap sort and merge sort;
  3. O(n1+§)) ordering, where § is a constant between 0 and 1. Hill sort
  4. Linear order (O(n)) sorting Radix sort, in addition to bucket and bin sorting.

About stability:

Stable sorting algorithms: bubble sort, insertion sort, merge sort, and radix sort.

Not a stable sorting algorithm: selection sort, quick sort, hill sort, heap sort.

Glossary:

n: data size

k: the number of "buckets"

In-place: occupies constant memory, does not occupy additional memory

Out-place: takes up extra memory

Stability: 2 equal key values ​​are in the same order after sorting as they were before sorting


GitBook Content Outline

  1. Bubble Sort
  2. SelectionSort
  3. Insertion Sort
  4. Hill Sort
  5. Merge Sort
  6. Quick Sort
  7. Heap Sort
  8. Counting Sort
  9. Bucket Sort
  10. Radix Sort

The content of this book comes almost entirely from the Internet.

Open source project address: https://github.com/hustcc/JS-Sorting-Algorithm, organizer [hustcc](https://github .com/hustcc).

GitBook online reading address: https://sort.hust.cc/.

This project uses lint-md to check the format of Chinese Markdown files. Make sure that the Markdown format is correct before submitting Pr.

About

A GitBook online book on sorting algorithms "Top Ten Classic Sorting Algorithms", implemented in multiple languages.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 50.3%
  • PHP 20.7%
  • Python 16.4%
  • Go 12.6%