mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2026-03-13 15:21:15 +08:00
Merge branch 'master' of github.com:charliejmoore/Javascript into comb-sort-tests
This commit is contained in:
@@ -54,11 +54,11 @@ function bucketSort (list, size) {
|
||||
}
|
||||
|
||||
// Testing
|
||||
const arrOrignal = [5, 6, 7, 8, 1, 2, 12, 14]
|
||||
// > bucketSort(arrOrignal)
|
||||
const arrOriginal = [5, 6, 7, 8, 1, 2, 12, 14]
|
||||
// > bucketSort(arrOriginal)
|
||||
// [1, 2, 5, 6, 7, 8, 12, 14]
|
||||
// Array before Sort
|
||||
console.log(arrOrignal)
|
||||
const arrSorted = bucketSort(arrOrignal)
|
||||
console.log(arrOriginal)
|
||||
const arrSorted = bucketSort(arrOriginal)
|
||||
// Array after sort
|
||||
console.log(arrSorted)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @function Intosort (As implemented in STD C++ Lib)
|
||||
* The function performs introsort which is used in
|
||||
* C++ Standard LIbrary, the implemntation is inspired from]
|
||||
* C++ Standard LIbrary, the implementation is inspired from]
|
||||
* library routine itself.
|
||||
* ALGORITHM:
|
||||
* 1) It performs quicksort on array until the recursion depth
|
||||
@@ -111,7 +111,7 @@ function introsort (array, compare) {
|
||||
*/
|
||||
quickSort(0, len, maxDepth)
|
||||
/**
|
||||
* A final checlk call to insertion sort
|
||||
* A final check call to insertion sort
|
||||
* on sorted array
|
||||
*/
|
||||
insertionSort(0, len)
|
||||
@@ -140,7 +140,7 @@ function introsort (array, compare) {
|
||||
}
|
||||
/**
|
||||
* @function Helper function to quicksort
|
||||
* @param {Number} start the start of array segment to partitiion
|
||||
* @param {Number} start the start of array segment to partition
|
||||
* @param {Number} last one more than last index of the array segment
|
||||
* @param {Number} pivot the index of pivot to be used
|
||||
* @returns {Number} the index of pivot after partition
|
||||
|
||||
@@ -37,7 +37,7 @@ const quickSort = (inputList, low, high) => {
|
||||
|
||||
/**
|
||||
* Partition In Place method.
|
||||
* @param {number[]} partitionList list for partiting.
|
||||
* @param {number[]} partitionList list for partitioning.
|
||||
* @param {number} low lower index for partition.
|
||||
* @param {number} high higher index for partition.
|
||||
* @returns {number} `pIndex` pivot index value.
|
||||
|
||||
@@ -30,7 +30,7 @@ const Timsort = (array) => {
|
||||
/**
|
||||
* @function performs insertion sort on the partition
|
||||
* @param {Array} array array to be sorted
|
||||
* @param {Number} left left index of partiton
|
||||
* @param {Number} left left index of partition
|
||||
* @param {Number} right right index of partition
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user