Skip to content

Commit f637aa3

Browse files
committedSep 13, 2021
edit
1 parent f9427c3 commit f637aa3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed
 

‎algorithms/sorting-and-searching/bubble-sort.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// impelmenting bubble sort algorithms
22

3-
function bubbleSortByDescending(arr = []) {
3+
function bubbleSortByAscending(arr = []) {
44
if (!Array.isArray(arr)) throw new Error("argument must be array");
55

66
for (let i = 0; i < arr.length; i++) {
@@ -14,7 +14,7 @@ function bubbleSortByDescending(arr = []) {
1414
}
1515
return arr;
1616
}
17-
function bubbleSortByAscending(arr) {
17+
function bubbleSortByDescending(arr) {
1818
if (!Array.isArray(arr)) throw new Error("argument must be array");
1919

2020
for (let i = 0; i < arr.length; i++) {
@@ -31,7 +31,7 @@ function bubbleSortByAscending(arr) {
3131

3232
// test both bubble sort
3333

34-
const sortedArrByDescending = bubbleSortByDescending([3, 46, 4, 6, 1, 7, 5]);
3534
const sortedArrByAscending = bubbleSortByAscending([3, 46, 4, 6, 2, 7, 5]);
36-
console.log(sortedArrByDescending);
35+
const sortedArrByDescending = bubbleSortByDescending([3, 46, 4, 6, 1, 7, 5]);
3736
console.log(sortedArrByAscending);
37+
console.log(sortedArrByDescending);

‎algorithms/sorting-and-searching/selection-sort.js

Whitespace-only changes.

0 commit comments

Comments
 (0)
Please sign in to comment.