Permalink
Browse files

Fix quick sort notes

  • Loading branch information...
hparra committed Mar 3, 2017
1 parent 53dd0a8 commit 4a31da1724b9099576185b76637f3c6dbc599bd6
Showing with 4 additions and 2 deletions.
  1. +4 −2 quick-sort.md
View
@@ -29,8 +29,8 @@ Quicksort:
- Quicksort each of the two partitions
Partition (Hoare):
1. move left pointer forward until you find a value > pivot
2. move right pointer backward until you find a value < pivot
1. while value < pivot move left pointer forward
2. while value > pivot move right pointer backward
3. now that you've found values on each side that actually belongs in the other:
- swap them
- move both pointers inwards
@@ -41,6 +41,8 @@ Performance:
- Best: O(n lg n)
- Average: O(n lg n)
Note: If you pick pivot to be first or last element, you will always be swapping it
## Overview
Quicksort is a divide & conquer sorting algorithm.

0 comments on commit 4a31da1

Please sign in to comment.