From 5742bf50097731f06cdfbc8a9232000f9b5f0bc2 Mon Sep 17 00:00:00 2001 From: Abose Ukhun Date: Mon, 16 Oct 2017 11:23:46 +0100 Subject: [PATCH] add to bubble sort information about big O complexity and efficiency --- Sorts/bubblesort.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sorts/bubblesort.js b/Sorts/bubblesort.js index 9f9659c7e..4bcd3904f 100644 --- a/Sorts/bubblesort.js +++ b/Sorts/bubblesort.js @@ -1,5 +1,7 @@ /*Bubble Sort is a algorithm to sort an array. It * compares adjacent element and swaps thier position +* The big O on bubble sort in worst and best case is O(N^2). + * Not efficient. */ function bubbleSort(items) { var length = items.length; @@ -25,3 +27,5 @@ console.log(ar); bubbleSort(ar); //Array after sort console.log(ar); + +