Selection sort is the simplest sorting algorithm that works by repeatedly finding the minimum element (considering ascending order) from the unsorted part and putting it at the beginning.
In order to know more about it. Please refer to Selection Sort
- Selection Sort.
- Button Generate New Array generates an array of random values using the Math.random() function and a bar corresponding to that value in terms of height.
- Different colors are used to indicate which elements are unsorted(sky-blue), compared(darkblue & red) & sorted(lightgreen).
- Button Selection Sort the elements using the selection sort algorithm.
- Finally, elements are sorted.
Example: Click Generate New Array button to generate a new random array. Click the Selection Sort button to perform Visualization.
- New array generated:
- After the sorting:
My Personal Notes arrow_drop_up
Please Login to comment...