Isaac Lagoy
GitHub YouTube

Visual Sorters

This program displays the process that a sorting algorithm takes to sort an array. The red line shows which part of the array is being swapped. Below you can find the algorithms included in this program, and more can be added if need be.

Get it on GitHub

Quick sort is a recursive sorting algorithm that divides the array into smaller sorting problems. By selecting a pivot and sorting elements to each side, the total array will eventually sort.

if low < high:

   # selects a pivot point
   pivot = array[high]
   i = low - 1
   for j in range(low, high):
      if array[j] <= pivot:
         i = i + 1

         # updates screen on change
         array[i], array[j] = array[j], array[i]
   array[i+1], array[high] = array[high], array[i+1]
   pivoit = i + 1

   # sorts left, right
   quick_sort(array, low, pivoit - 1)
   quick_sort(array, pivoit + 1, high)