We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 19b4ced commit 1992d52Copy full SHA for 1992d52
sorts/bubble_sort.ts
@@ -19,7 +19,7 @@
19
20
export const bubbleSort = (arr: number[]): number[] => {
21
for (let i = 0; i < arr.length; i++) {
22
- for (let j = 0; j < arr.length - 1; j++) {
+ for (let j = 0; j < arr.length - i; j++) {
23
//iterating till the 2nd last element of array
24
if (arr[j] > arr[j + 1]) {
25
//current indexed number > next indexed number
0 commit comments