This application makes the process of sorting an array visible by displaying each list item as a bar of different height and highlighting the bars that are currently swapped.
You can adjust the speed and number of array elements and choose from several different algorithms. The array is randomly generated each time.
Insertion sort: The array is divided into a sorted and an unsorted part, and elements are sequentially inserted into their proper position in the sorted part by swapping them with their predecessor, as long as the predecessor has a higher value.
Selection sort: The array is divided into a sorted and an unsorted part, and the lowest value is chosen from the unsorted part and inserted at the end of the sorted part.
Quicksort: The array is recursively divided by choosing one item and putting all items of lower value left, and all higher right of the chosen.
Heapsort: This algorithm works by maintaining a binary tree data structure to have the largest element of the unsorted area at the first position, thus avoiding scanning the entire unsorted region for each element, like one would have to do with selection sort.
Jan F. 15. Sep 2022
origami24.net | Impressum | Datenschutz