Skip to content

Commit 341b64b

Browse files
authored
Quicksort documentation
1 parent 49e476b commit 341b64b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/sorting/Quicksort

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Quicksort
2+
3+
A quicksort is a quicker method of sorting, and there are four different ways of implementing it. The example given uses a pivot point.
4+
5+
A pivot point is created in the middle of an array, and all larger items go after the pivot point, and smaller items are placed in front
6+
of the pivot point.
7+
8+
The pivot point is then moved to the middle of either the smaller or larger items, and the sort is run again on that half.
9+
10+
This continues over and over again until everything is in the proper place.
11+
12+
Usage
13+
from allalgorithms.sorting import quicksort
14+
15+
arr = [77, 2, 10, -2, 1, 7]
16+
17+
print(quicksort(arr))
18+
# -> [-2, 1, 2, 7, 10, 77]
19+
20+
API
21+
22+
quicksort(array)
23+
Returns a sorted array
24+
25+
Params:
26+
array: Unsorted Array

0 commit comments

Comments
 (0)