Skip to content

Commit

Permalink
Updated Bubble Sort description
Browse files Browse the repository at this point in the history
Added the runtime, memory and a better description of bubble sort. The implementation was not added but it is good to know the concept.
  • Loading branch information
lostatseajoshua authored Aug 21, 2016
1 parent 58bb5ef commit 6e77eba
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Bubble Sort/README.markdown
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# Bubble Sort

This is a horrible algorithm. There is no reason why you should have to know it.
Bubble sort is a sorting algorthim that is implemented by starting in the beginning of the array and swapping the first two elements only if the first element is greater than the second element. This comparision is then moved onto the next pair and so on and so forth. This is done until the the array is completely sorted. The smaller items slowly “bubble” up to the beginning of the array.

Runtime:
- Average: O(N^2)
- Worst: O(N^2)

Memory:
- O(1)

Implementation:
The implemenatation will not be shown because as you can see from the average and worst runtimes this is a very inefficent algorithm but having a grasp of the concept will help in getting to know the basics of simple sorting algorthims.

0 comments on commit 6e77eba

Please sign in to comment.