Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a3487e4

Browse files
committed
quick sort
1 parent 9f8c936 commit a3487e4

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

1/QuickSort.org

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
* Quick Sort
2+
#+BEGIN_SRC
3+
[4,3,1]
4+
|
5+
quickSort(array,0,2)
6+
|
7+
array[4,3,1] ; left = 0 ; right = 2 ; pivotPos = 1; ...........
8+
|
9+
array[1,3,4] left = 0, right = 2, pivotIndex = 0 + 1 = 1; pivot=3; leftB = 1; rightB=0
10+
R L
11+
12+
Worst case O(n^2)
13+
Average case O(nlogn)
14+
#+END_SRC

1/QuickSort.org~

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
* Quick Sort
2+
#+BEGIN_SRC
3+
[4,3,1]
4+
|
5+
quickSort(array,0,2)
6+
|
7+
array[4,3,1] ; left = 0 ; right = 2 ; pivotPos = 1; ...........
8+
|
9+
array[1,3,4] left = 0, right = 2, pivotIndex = 0 + 1 = 1; pivot=3; leftB = 1; rightB=0
10+
R L
11+
12+
13+
14+
15+
16+
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
#+END_SRC

0 commit comments

Comments
 (0)