File tree Expand file tree Collapse file tree 5 files changed +6
-8
lines changed Expand file tree Collapse file tree 5 files changed +6
-8
lines changed Original file line number Diff line number Diff line change 7
7
* NOTE: It only works for arrays of positive integers.
8
8
*
9
9
* Wikipedia: https://en.wikipedia.org/wiki/Bead_sort
10
- * @param {number[] } sequence An array of positive integers to be sorted using Bead Sort .
11
- * @returns {number[] } Returns a sorted array of positive integers using Bead Sort .
10
+ * @param {number[] } sequence An array of positive integers to be sorted.
11
+ * @returns {number[] } Returns a sorted array of positive integers.
12
12
* @throws {RangeError } Throws a RangeError if the input sequence contains any negative integers.
13
13
*/
14
14
export function beadSort ( sequence ) {
Original file line number Diff line number Diff line change 1
1
/**
2
2
* Checks whether the given array is sorted in ascending order.
3
- * @param {number [] } array The array to be checked for sorted order.
3
+ * @param {String [] }
4
4
* @returns {boolean } Returns true if the array is sorted in ascending order, false otherwise.
5
5
*/
6
6
export function isSorted ( array ) {
@@ -15,7 +15,7 @@ export function isSorted(array) {
15
15
16
16
/**
17
17
* Shuffles the given array randomly in place.
18
- * @param {any[] } array The array to be shuffled.
18
+ * @param {any[] }
19
19
*/
20
20
function shuffle ( array ) {
21
21
for ( let i = array . length - 1 ; i ; i -- ) {
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ export function bubbleSort(items) {
44
44
45
45
/**
46
46
* Using a while loop and a for loop.
47
- * @param {number[] } arr The array to be sorted.
47
+ * @param {number[] }
48
48
* @returns {number[] } The sorted array.
49
49
*/
50
50
export function alternativeBubbleSort ( arr ) {
Original file line number Diff line number Diff line change 8
8
* Wikipedia (Cocktail Shaker Sort): https://en.wikipedia.org/wiki/Cocktail_shaker_sort
9
9
* Wikipedia (Bubble Sort): https://en.wikipedia.org/wiki/Bubble_sort
10
10
*
11
- * @param {number[] } items The array of numbers to be sorted.
11
+ * @param {number[] }
12
12
* @returns {number[] } The sorted array.
13
13
*/
14
14
export function cocktailShakerSort ( items ) {
Original file line number Diff line number Diff line change 1
1
/**
2
- * Shuffles the elements of the given array randomly in place.
3
- * @param {Array } array The array to be shuffled.
4
2
* @returns {Array } The shuffled array.
5
3
*/
6
4
export const shuffle = ( array ) => {
You can’t perform that action at this time.
0 commit comments