From e3ff82fcbaf601f3ce3392225a447bee04fa3fb2 Mon Sep 17 00:00:00 2001 From: Oleksii Trekhleb Date: Tue, 29 May 2018 07:36:41 +0300 Subject: [PATCH] Add counting sort. --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0e03d3c5..7c68b9c3 100644 --- a/README.md +++ b/README.md @@ -217,13 +217,13 @@ Below is the list of some of the most used Big O notations and their performance ### Array Sorting Algorithms Complexity -| Name | Best | Average | Worst | Memory | Stable | -| --------------------- | :-------: | :-------: | :-----------: | :-------: | :-------: | -| **Bubble sort** | n | n^2 | n^2 | 1 | Yes | -| **Insertion sort** | n | n^2 | n^2 | 1 | Yes | -| **Selection sort** | n^2 | n^2 | n^2 | 1 | No | -| **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | No | -| **Merge sort** | n log(n) | n log(n) | n log(n) | n | Yes | -| **Quick sort** | n log(n) | n log(n) | n^2 | log(n) | No | -| **Shell sort** | n log(n) | depends on gap sequence | n (log(n))^2 | 1 | No | -| **Counting sort** | n + r | n + r | n + r | n + r | Yes | +| Name | Best | Average | Worst | Memory | Stable | Comments | +| --------------------- | :-------: | :-------: | :-----------: | :-------: | :-------: | :-------- | +| **Bubble sort** | n | n^2 | n^2 | 1 | Yes | | +| **Insertion sort** | n | n^2 | n^2 | 1 | Yes | | +| **Selection sort** | n^2 | n^2 | n^2 | 1 | No | | +| **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | No | | +| **Merge sort** | n log(n) | n log(n) | n log(n) | n | Yes | | +| **Quick sort** | n log(n) | n log(n) | n^2 | log(n) | No | | +| **Shell sort** | n log(n) | depends on gap sequence | n (log(n))^2 | 1 | No | | +| **Counting sort** | n + r | n + r | n + r | n + r | Yes | r - biggest number in sorted array |