Algorithms Visualized

Divide and Conquer
Setting variables, then calling quickSort
Beginning of the quickSort function
[7, 0, 2, 1, 9, 2]
Moving the pointers to the center, rearranging elements
targetArray = [2, 0, 1, 2, 9, 7]
(all values lower than 2 are left of 2 and all values larger than 2 are on the right of 2)
lowIndex = 0
highIndex = 5
leftPointer = 3
rightPointer = 2
(the leftPointer has passed the rightPointer)
quickSort is called recursively for the sub arrays
[0, 1, 2, 2, 7, 9, 2]
Why?
https://www.toptal.com/developers/sorting-algorithms

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store