Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ae93e49

Browse files
fixing formatting to avoid code/style workflow fail
1 parent 1ec1979 commit ae93e49

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

‎Search/BinarySearch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @param {number} low - The lower bound index of the search interval (default is 0).
1414
* @param {number} high - The upper bound index of the search interval (default is arr.length - 1).
1515
* @returns {number} - The index of the found element if present, otherwise -1.
16-
*/
16+
*/
1717
function binarySearchRecursive(arr, x, low = 0, high = arr.length - 1) {
1818
const mid = Math.floor(low + (high - low) / 2)
1919

@@ -41,7 +41,7 @@ function binarySearchRecursive(arr, x, low = 0, high = arr.length - 1) {
4141
* @param {number} low - The lower bound index of the search interval (default is 0).
4242
* @param {number} high - The upper bound index of the search interval (default is arr.length - 1).
4343
* @returns {number} - The index of the found element if present, otherwise -1.
44-
*/
44+
*/
4545
function binarySearchIterative(arr, x, low = 0, high = arr.length - 1) {
4646
while (high >= low) {
4747
const mid = Math.floor(low + (high - low) / 2)

‎Search/ExponentialSearch.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ function binarySearch(arr, value, floor, ceiling) {
3838
return binarySearch(arr, value, mid + 1, ceiling)
3939
}
4040
}
41-
/**
42-
* Exponential Search
43-
* @param {number[]} arr - The array to search within.
44-
* @param {number} length - The length of the array.
45-
* @param {number} value - The value to search for in the array.
46-
* @returns {number} - The index of the found element if present, otherwise -1.
47-
*/
41+
/**
42+
* Exponential Search
43+
* @param {number[]} arr - The array to search within.
44+
* @param {number} length - The length of the array.
45+
* @param {number} value - The value to search for in the array.
46+
* @returns {number} - The index of the found element if present, otherwise -1.
47+
*/
4848
function exponentialSearch(arr, length, value) {
4949
// If value is the first element of the array return this position
5050
if (arr[0] === value) {

‎Search/QuickSelectSearch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
/**
1515
* @function quickSelectSearch
16-
* @param {number[]} array - The array of numbers to select the `k` smallest elements from.
16+
* @param {number[]} array - The array of numbers to select the `k` smallest elements from.
1717
* @param {number} k - The number of smallest elements to select.
1818
* @returns {number[]} - A slice of the `k` smallest elements from the array.
1919
* @throws {Error} - Throws an error if the array is empty or if `k` is greater than or equal to the array length.

‎Search/RabinKarp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* [Reference](https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm)
1414
*/
1515
/**
16-
* @param {string} text - The text string in which to search for the pattern.
16+
* @param {string} text - The text string in which to search for the pattern.
1717
* @param {string} pattern - The pattern string to search for in the text.
1818
* @returns {number[]} - An array of indices where the pattern is found in the text. Returns an empty array if the pattern is not found.
1919
*
@@ -26,7 +26,7 @@
2626
*
2727
* @see {@link https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm}
2828
*/
29-
29+
3030
const BASE = 256 // The number of characters in the alphabet
3131
const MOD = 997 // A prime number used for the hash function
3232

‎Search/TernarySearch.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
* Reference: https://www.geeksforgeeks.org/ternary-search/
1212
*/
1313
/**
14-
*
14+
*
1515
* @param {number[]} arr - The sorted array to search in.
1616
* @param {number} key - The key to search for.
1717
* @param {number} [low=0] - The lowest index of the search range.
1818
* @param {number} [high=arr.length - 1] - The highest index of the search range.
1919
* @returns {number} - The index of the key if found, otherwise -1.
20-
*/
21-
20+
*/
21+
2222
function ternarySearchRecursive(arr, key, low = 0, high = arr.length - 1) {
2323
if (high >= low) {
2424
// find the mid1 and mid2
@@ -54,13 +54,13 @@ function ternarySearchRecursive(arr, key, low = 0, high = arr.length - 1) {
5454
return -1
5555
}
5656
}
57-
/**
58-
* @param {number[]} arr - The sorted array to search in.
59-
* @param {number} key - The key to search for.
60-
* @param {number} [low=0] - The lowest index of the search range.
61-
* @param {number} [high=arr.length - 1] - The highest index of the search range.
62-
* @returns {number} - The index of the key if found, otherwise -1.
63-
*/
57+
/**
58+
* @param {number[]} arr - The sorted array to search in.
59+
* @param {number} key - The key to search for.
60+
* @param {number} [low=0] - The lowest index of the search range.
61+
* @param {number} [high=arr.length - 1] - The highest index of the search range.
62+
* @returns {number} - The index of the key if found, otherwise -1.
63+
*/
6464
function ternarySearchIterative(arr, key, low = 0, high = arr.length - 1) {
6565
while (high >= low) {
6666
// find the mid1 and mid2

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /