Selection Sort

Selection Sort is a straight forward sorting algorithm that works by repeatedly selecting the smallest (or largest, depending on the order) element from an unsorted portion of the list and moving it to the beginning (or end) of the sorted portion. Here's how it works step-by-step:

  1. Start with the first element: Assume the first element is the smallest in the list.
  2. Find the smallest element: Look through the rest of the list to find the smallest element.
  3. Swap: If you find a smaller element, swap it with the first element.
  4. Move to the next position: Now consider the first element as sorted and move to the next element in the list.
  5. Repeat the process: Repeat the process for the rest of the list until the entire list is sorted.
  6. Repeat: Keep repeating until you make a pass without any swaps, which means the list is sorted.

Speed