Selection Sort Visualization


Selection Sort - Sorting Algorithm Visualizer

DESCRIPTION

Selection Sort is a simple and efficient **comparison-based sorting algorithm** that divides the array into a sorted and an unsorted region. It repeatedly selects the smallest (or largest) element from the unsorted part and swaps it with the first unsorted element, expanding the sorted portion with each iteration.

The algorithm works by scanning the array for the smallest element and swapping it with the first element. Then, it finds the next smallest element and swaps it with the second element, and so on, until the entire list is sorted.

Unlike Bubble Sort, Selection Sort makes fewer swaps, making it more efficient in terms of write operations. However, it still has a **time complexity of O(n²)** in both the worst and average cases, making it inefficient for large datasets.

One advantage of Selection Sort is that it performs well on small datasets and requires minimal swaps, making it useful when memory write operations are costly.

Selection Sort is an **in-place sorting algorithm**, meaning it does not require additional memory. However, it is **not a stable sort**, meaning equal elements may not maintain their original relative order after sorting.

COMPLEXITY

Average Complexity O(n²)
Best Case O(n²)
Worst Case O(n²)
Space Complexity O(1)
Selection Sort Visualization

Selection SORT IMPLEMENTATION

                    
                
Selection Sort Visualization