mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2026-03-13 15:21:15 +08:00
fix: standard style issues
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
* @param {number} endIndex The end of the subarray
|
||||
* @returns The flipped array
|
||||
*/
|
||||
export function flipArray(array, startIndex, endIndex) {
|
||||
export function flipArray (array, startIndex, endIndex) {
|
||||
while (startIndex < endIndex) {
|
||||
// swap front and back of the subarray
|
||||
const temp = array[startIndex]
|
||||
@@ -49,7 +49,7 @@ export function flipArray(array, startIndex, endIndex) {
|
||||
* @param {*} endIndex The end of the subarray
|
||||
* @returns The index of the maximum number
|
||||
*/
|
||||
export function findMax(array, startIndex, endIndex) {
|
||||
export function findMax (array, startIndex, endIndex) {
|
||||
let maxIndex = 0
|
||||
for (let i = startIndex; i <= endIndex; i++) {
|
||||
if (array[i] > array[maxIndex]) maxIndex = i
|
||||
@@ -67,7 +67,7 @@ export function findMax(array, startIndex, endIndex) {
|
||||
* @param {number[]} array The array to sort
|
||||
* @returns The sorted array
|
||||
*/
|
||||
export function pancakeSort(array) {
|
||||
export function pancakeSort (array) {
|
||||
for (let subarraySize = array.length; subarraySize > 1; subarraySize--) {
|
||||
const maximumIndex = findMax(array, 0, subarraySize - 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user