Sorting Algorithms

A Sorting Algorithm is used to rearrange a given array or list of elements in an order. For example, a given array [10, 20, 5, 2] becomes [2, 5, 10, 20] after sorting in increasing order and becomes [20, 10, 5, 2] after sorting in decreasing order.

Learn about the history, concepts, and types of sorting algorithms in computer science. Compare the performance, complexity, and examples of different sorting methods such as bubble sort, merge sort, and Timsort.
Introduction to Sorting Techniques

Why Sorting Algorithms are Important Sorting algorithms are essential in Computer Science as they simplify complex problems and improve efficiency. They are widely used in searching, databases, divide and conquer strategies, and data structures.
Learn what sorting algorithm is and how to compare different types of sorting algorithms based on their time and space complexity and stability. See examples of bubble sort, selection sort, insertion sort, merge sort, quicksort, counting sort, radix sort, bucket sort, heap sort and shell sort.

Sort Visualizer
Learn how sorting algorithms work by visualizing their steps and performance. Compare logarithmic, quadratic, weird and custom sorts with space and time complexity analysis.
Learn how Quick Sort and other sorting algorithms work by watching them sort different data on various graphs. Adjust the settings to customize the sorting process and see the statistics.

Sorting (Bubble, Selection, Insertion, Merge, Quick ...
Sorting problem has a variety of interesting algorithmic solutions that embody many Computer Science ideas: Comparison versus non-comparison based strategies, Iterative versus Recursive implementation, Divide-and-Conquer paradigm (e.g., Merge Sort or Quick Sort), Best/Worst/Average-case Time Complexity analysis, Randomized Algorithms , etc.
Our sorting algorithms in the lecture notes return void. Refactor the implementation of insertionSort (), mergeSort (), and quicksort () to return an int representing the number of comparisons needed to sort the array.

Key Details About Sorting Algorithms
Master sorting algorithms through interactive visualizations. Compare efficiency, watch step-by-step executions, and explore code implementations.




Sorting refers to arranging data in a particular format. Sorting algorithm specifies the way to arrange data in a particular order. Most common orders are in numerical or lexicographical order.