-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
fixing JSDOCS for Sorts Folder the folder that been modified are Alph… #1649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| /** | ||
| * Checks whether the given array is sorted in ascending order. | ||
| * @param {number[]} array The array to be checked for sorted order. | ||
|
||
| * @returns {boolean} Returns true if the array is sorted in ascending order, false otherwise. | ||
| */ | ||
| export function isSorted(array) { | ||
| const length = array.length | ||
|
|
@@ -13,6 +15,7 @@ export function isSorted(array) { | |
|
|
||
| /** | ||
| * Shuffles the given array randomly in place. | ||
| * @param {any[]} array The array to be shuffled. | ||
|
||
| */ | ||
| function shuffle(array) { | ||
| for (let i = array.length - 1; i; i--) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ | |
|
|
||
| /** | ||
| * Using 2 for loops. | ||
| * @param {number[]} items The array to be sorted. | ||
| * @returns {number[]} The sorted array. | ||
| */ | ||
| export function bubbleSort(items) { | ||
| const length = items.length | ||
|
|
@@ -42,6 +44,8 @@ export function bubbleSort(items) { | |
|
|
||
| /** | ||
| * Using a while loop and a for loop. | ||
| * @param {number[]} arr The array to be sorted. | ||
|
||
| * @returns {number[]} The sorted array. | ||
| */ | ||
| export function alternativeBubbleSort(arr) { | ||
| let swapped = true | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,9 @@ | |
| * | ||
| * Wikipedia (Cocktail Shaker Sort): https://en.wikipedia.org/wiki/Cocktail_shaker_sort | ||
| * Wikipedia (Bubble Sort): https://en.wikipedia.org/wiki/Bubble_sort | ||
| * | ||
| * @param {number[]} items The array of numbers to be sorted. | ||
|
||
| * @returns {number[]} The sorted array. | ||
| */ | ||
| export function cocktailShakerSort(items) { | ||
| for (let i = items.length - 1; i > 0; i--) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| /** | ||
| * Shuffles the elements of the given array randomly in place. | ||
|
||
| * @param {Array} array The array to be shuffled. | ||
| * @returns {Array} The shuffled array. | ||
| */ | ||
| export const shuffle = (array) => { | ||
| let maxLength = array.length | ||
| let temp | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "using Bead Sort" is not helpful here or in the next line.