Skip to content

Commit c5e4e2e

Browse files
authored
Merge pull request #1 from j4zib/master
fixed bubble sort loop
2 parents 5dc6d19 + a79323e commit c5e4e2e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

algorithms/Bubble_Sort.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// O(n^2)
2-
for(int i = 0; i < n; ++i)
2+
for(int i = 0; i < n - 1; ++i)
33
for(int j = 0, m = n - i - 1; j < m; ++j)
44
if(arr[j] > arr[j + 1])
55
swap(arr[j], arr[j + 1]);

0 commit comments

Comments
 (0)