An open API service indexing awesome lists of open source software.

https://github.com/anoopraju31/sorting-algorithms


https://github.com/anoopraju31/sorting-algorithms

Last synced: 9 months ago
JSON representation

Awesome Lists containing this project

README

          

# Sorting Algorithms

Sorting algorithms are essential tools in computer science used to rearrange a list of elements into a particular order. There are numerous sorting algorithms, each with its own advantages and disadvantages in terms of time complexity, space complexity, stability, and adaptability to different types of data.

Some common sorting algorithms:
1. **Bubble Sort:** It repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. It continues until no swaps are needed, indicating that the list is sorted.
2. **Selection Sort:** It repeatedly selects the minimum element from the unsorted portion of the list and swaps it with the first unsorted element. This process continues until the entire list is sorted.
3. **Insertion Sort:** It builds the final sorted list one item at a time, removing one element from the input data and inserting it into the correct position in the sorted list.
4. **Merge Sort:** It is a divide-and-conquer algorithm that recursively divides the input list into two halves, sorts each half, and then merges the sorted halves to produce the final sorted list.
5. **Quick Sort:** It is also a divide-and-conquer algorithm that selects a 'pivot' element from the list and partitions the other elements into two sub-lists according to whether they are less than or greater than the pivot. It then recursively sorts the sub-lists.
6. **Heap Sort:** It builds a binary heap from the input list and then repeatedly extracts the maximum (for a max-heap) element from the heap and rebuilds the heap until the list is sorted.
7. **Radix Sort:** It sorts numbers by processing individual digits of the numbers. It can be implemented using different methods such as LSD (Least Significant Digit) or MSD (Most Significant Digit).
8. **Counting Sort:** It is a non-comparison-based sorting algorithm that works by counting the number of occurrences of each unique element in the input list and using this information to reconstruct the sorted list.