Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5742bf5

Browse files
committed
add to bubble sort information about big O complexity and efficiency
1 parent 29d252e commit 5742bf5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎Sorts/bubblesort.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/*Bubble Sort is a algorithm to sort an array. It
22
* compares adjacent element and swaps thier position
3+
* The big O on bubble sort in worst and best case is O(N^2).
4+
* Not efficient.
35
*/
46
function bubbleSort(items) {
57
var length = items.length;
@@ -25,3 +27,5 @@ console.log(ar);
2527
bubbleSort(ar);
2628
//Array after sort
2729
console.log(ar);
30+
31+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /