- ✕This summary was generated using AI based on multiple online sources. To view the original source information, use the "Learn more" links.
Sorting algorithms are fundamental in computer science, used to arrange data in a specific order (e.g., ascending or descending). Below are some of the most important sorting algorithms, categorized by their approach and efficiency:
Comparison-Based Sorting Algorithms
1. Bubble Sort
Description: Repeatedly swaps adjacent elements if they are in the wrong order.
Time Complexity: Best: O(n), Worst: O(n²), Average: O(n²).
Space Complexity: O(1) (in-place).
Stability: Yes.
Use Case: Simple but inefficient for large datasets.
2. Insertion Sort
Description: Builds the sorted array one element at a time by inserting elements into their correct position.
Time Complexity: Best: O(n), Worst: O(n²), Average: O(n²).
Space Complexity: O(1) (in-place).
Stability: Yes.
Use Case: Efficient for small or nearly sorted datasets.
3. Selection Sort
Sorting Algorithms - GeeksforGeeks
Jan 20, 2026 · 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, …
Sorting Algorithm - Programiz
- A sorting algorithm is considered stable if the two or more items with the same value maintain the same relative positions even after sorting. For example, in the image below, there are two items with the same value 3. An unstable sorting algorithm allows two possibilities where the two positions of 3 may or may not be maintained. However, after a ...
Sorting Algorithms Explained with Examples in …
Dec 4, 2019 · What is a Sorting Algorithm? Sorting algorithms are a set of instructions that take an array or list as an input and arrange the items into a …
Sorting algorithm - Wikipedia
In computer science, a sorting algorithm is an algorithm that puts elements of a list into an order. The most frequently used orders are numerical order and …
Sorting - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
- People also ask
SortVision - Interactive Sorting Algorithm Visualizer
Master sorting algorithms with interactive visualizations, animations, and time complexity analysis. Learn bubble sort, merge sort, quick sort, heap sort with real …
Sorting Algorithms: The Foundation of Efficient …
Sorting algorithms are a fundamental part of computer science and play a crucial role in efficient programming. From simple algorithms like Bubble Sort to more …
Practical Sorting Algorithm Examples in Programming …
Unravel the magic of sorting algorithms! Dive into our comprehensive programming guide packed with practical examples. Boost your coding efficiency now!
Sorting Algorithms Complete Guide: Master All 9 …
Jan 15, 2025 · Master all sorting algorithms including bubble sort, merge sort, quick sort, heap sort with implementations, comparisons, and when to use each. …