npx standard --fix

This commit is contained in:
cclauss
2020-05-03 09:05:12 +02:00
parent e62ad2f73e
commit 856dc2f63c
47 changed files with 2240 additions and 2371 deletions

View File

@ -2,37 +2,36 @@
* Quick sort is a comparison sorting algorithm that uses a divide and conquer strategy.
* For more information see here: https://en.wikipedia.org/wiki/Quicksort
*/
function quickSort(items) {
var length = items.length;
function quickSort (items) {
var length = items.length
if (length <= 1) {
return items;
return items
}
var PIVOT = items[0];
var GREATER = [];
var LESSER = [];
var PIVOT = items[0]
var GREATER = []
var LESSER = []
for (var i = 1; i < length; i++) {
if (items[i] > PIVOT) {
GREATER.push(items[i]);
GREATER.push(items[i])
} else {
LESSER.push(items[i]);
LESSER.push(items[i])
}
}
var sorted = quickSort(LESSER);
sorted.push(PIVOT);
sorted = sorted.concat(quickSort(GREATER));
return sorted;
var sorted = quickSort(LESSER)
sorted.push(PIVOT)
sorted = sorted.concat(quickSort(GREATER))
return sorted
}
//Implementation of quick sort
// Implementation of quick sort
var ar = [0, 5, 3, 2, 2];
//Array before Sort
console.log(ar);
ar = quickSort(ar);
//Array after sort
console.log(ar);
var ar = [0, 5, 3, 2, 2]
// Array before Sort
console.log(ar)
ar = quickSort(ar)
// Array after sort
console.log(ar)