fix: Replace Array.prototype.sort and update old isSorted method. (#39360)
* fix: Replace Array.prototype.sort and update old isSorted method. * fix: Change name of function from 'checkInBuiltSort' to 'checkBuilitInSort'. * fix: Change name of function from 'checkBuilitInSort' to 'isBuiltInSortUsed'.
This commit is contained in:
@ -91,8 +91,10 @@ function permutationSort(arr) {
|
||||
}
|
||||
}
|
||||
|
||||
function isSorted(a) {
|
||||
for (var i = 1; i < a.length; i++) if (a[i - 1] > a[i]) return false;
|
||||
function isSorted(a){
|
||||
for(let i = 0; i < a.length - 1; i++)
|
||||
if(a[i] > a[i + 1])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user