This interactive repository showcases the Selection Sort algorithm using JavaScript and HTML. Witness how an array is sorted visually in ascending order, with each step clearly represented.
What is Selection Sort?
Selection Sort is a fundamental comparison-based sorting technique. It repeatedly searches through the unsorted portion of an array, finding the minimum element and swapping it with the element at the beginning of that unsorted section. This process continues until the entire array is sorted.
Key Points:
- Time Complexity: O(n^2) in all cases - The number of comparisons and swaps grows quadratically with the input size (n). This means larger arrays take more time to sort using Selection Sort.
- Space Complexity: O(1) - Selection Sort is an in-place sorting algorithm, meaning it modifies the original array without requiring significant additional data structures.
Get Sorting!
- Clone this repository.
- Open
index.html
in your web browser. - Observe the visual representation as the array is sorted step-by-step.