From 1b8075c132979f905da729a0fcc0e7e8a60aefa2 Mon Sep 17 00:00:00 2001 From: Oleksii Trekhleb Date: Fri, 13 Apr 2018 06:38:38 +0300 Subject: [PATCH] Add big O sheet for sorting algorithms. --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a5657673..a1c5ac59 100644 --- a/README.md +++ b/README.md @@ -90,11 +90,12 @@ Below is the list of some of the most used Big O notations and their performance ![Common Data Structure Operations](https://github.com/trekhleb/javascript-algorithms/blob/master/assets/big-o-data-structures.png) Source: [Big O Cheat Sheet](http://bigocheatsheet.com/). -### Array Sorting Algorithms +### Array Sorting Algorithms Complexity ![Big O of sorting algoritms](https://github.com/trekhleb/javascript-algorithms/blob/master/assets/big-o-sorting-algorithms.png) Source: [Big O Cheat Sheet](http://bigocheatsheet.com/). -| Name | Best | Average | Worst | Memory | Stable | Method | Notes | -| ------------------| :-----: | :-------: | :-----: | :-------: | :-------: | :------------ | :-------------- | -| **Bubble sort** | n | n^2 | n^2 | 1 | Yes | Exchanging | Tiny code size. | +| Name | Best | Average | Worst | Memory | Stable | Method | Notes | +| --------------------- | :-----: | :-------: | :-----: | :-------: | :-------: | :------------ | :-------------- | +| **Bubble sort** | n | n^2 | n^2 | 1 | Yes | Exchanging | Tiny code size | +| **Selection sort** | n^2 | n^2 | n^2 | 1 | No | Selection | Stable with O(n) extra space, for example using lists |