Skip to content

Commit f8749d3

Browse files
committed
Create quicksort.js
vJechsmayr#4
1 parent fef1e57 commit f8749d3

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎SortingAlgorithms/quicksort.js‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//Language: Javascript
2+
//Author: Viktoria Jechsmayr
3+
//Github: https://github.com/vjechsmayr
4+
function quickSort(arr, left, right){
5+
var len = arr.length,
6+
pivot,
7+
partitionIndex;
8+
9+
10+
if(left < right){
11+
pivot = right;
12+
partitionIndex = partition(arr, pivot, left, right);
13+
14+
//sort left and right
15+
quickSort(arr, left, partitionIndex - 1);
16+
quickSort(arr, partitionIndex + 1, right);
17+
}
18+
return arr;
19+
}

0 commit comments

Comments
 (0)