Merge branch 'master' of github.com:charliejmoore/Javascript into comb-sort-tests

This commit is contained in:
Charlie Moore
2021-10-05 09:02:26 -04:00
57 changed files with 554 additions and 348 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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.

View File

@@ -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
*/