File tree Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -96,8 +96,9 @@ Source: [Big O Cheat Sheet](http://bigocheatsheet.com/).
96
96
![ Big O of sorting algoritms] ( https://github.com/trekhleb/javascript-algorithms/blob/master/assets/big-o-sorting-algorithms.png )
97
97
Source: [ Big O Cheat Sheet] ( http://bigocheatsheet.com/ ) .
98
98
99
- | Name | Best | Average | Worst | Memory | Stable | Method | Notes |
100
- | --------------------- | :-----: | :-------: | :-----: | :-------: | :-------: | :------------ | :-------------- |
101
- | ** Bubble sort** | n | n^2 | n^2 | 1 | Yes | Exchanging | Tiny code size |
102
- | ** Insertion sort** | n | n^2 | n^2 | 1 | Yes | Insertion | O(n + d), in the worst case over sequences that have d inversions |
103
- | ** Selection sort** | n^2 | n^2 | n^2 | 1 | No | Selection | Stable with O(n) extra space, for example using lists |
99
+ | Name | Best | Average | Worst | Memory | Stable | Method | Notes |
100
+ | --------------------- | :-------: | :-------: | :-------: | :-------: | :-------: | :------------ | :-------------- |
101
+ | ** Bubble sort** | n | n^2 | n^2 | 1 | Yes | Exchanging | Tiny code size |
102
+ | ** Insertion sort** | n | n^2 | n^2 | 1 | Yes | Insertion | O(n + d), in the worst case over sequences that have d inversions |
103
+ | ** Selection sort** | n^2 | n^2 | n^2 | 1 | No | Selection | Stable with O(n) extra space, for example using lists |
104
+ | ** Heap sort** | n log(n) | n log(n) | n log(n) | 1 | No | Selection | |
Original file line number Diff line number Diff line change @@ -8,3 +8,7 @@ The pass through the list is repeated until no swaps
8
8
are needed, which indicates that the list is sorted.
9
9
10
10
![ Algorithm Visualization] ( https://upload.wikimedia.org/wikipedia/commons/c/c8/Bubble-sort-example-300px.gif )
11
+
12
+ ## References
13
+
14
+ [ Wikipedia] ( https://en.wikipedia.org/wiki/Bubble_sort )
Original file line number Diff line number Diff line change 10
10
11
11
![ Algorithm Visualization] ( https://upload.wikimedia.org/wikipedia/commons/0/0f/Insertion-sort-example-300px.gif )
12
12
13
+ ## References
14
+
15
+ [ Wikipedia] ( https://en.wikipedia.org/wiki/Insertion_sort )
Original file line number Diff line number Diff line change @@ -12,3 +12,7 @@ memory is limited.
12
12
![ Algorithm Visualization] ( https://upload.wikimedia.org/wikipedia/commons/b/b0/Selection_sort_animation.gif )
13
13
14
14
![ Algorithm Visualization] ( https://upload.wikimedia.org/wikipedia/commons/9/94/Selection-Sort-Animation.gif )
15
+
16
+ ## References
17
+
18
+ [ Wikipedia] ( https://en.wikipedia.org/wiki/Selection_sort )
You can’t perform that action at this time.
0 commit comments