You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This algorithm will iterate over the array and repeatedly compare adjacent elements, swapping them if they are not in the correct order.
Selection Sort
This algorithm will iterate over the array, finding the minimum element from the unsorted portion, and swap it in place with the first element of unsorted portion.
Insertion Sort
This algorithm splits the array into sorted and unsorted parts, picking elements from the unsorted portion and placing them in the correct position of the sorted portion.
Merge Sort
This algorithm recursively splits the array in half until it cannot be further divided. It will then begin merging from the smallest units based on the comparison of the two, and continue until you have a final sorted array.
Quick Sort
This algorithm picks a pivot element and partitions the array around the pivot. The partition will put all array elements greater than the pivot to the right, and lesser than to the left. This is called recursively to produce the sorted array.
Performance
When choosing a sorting algorithm, you must consider the limitations and requirements.
Establishing key factors such as the size of your dataset and how much memory is available to run the sort will help you determine which sort is best for you.
Algorithms such as Bubble sort are slow, and not suitable for large collections, whilst Merge sort is resource intensive.
Check out the performance of each sort in the visualiser to help you decide.