Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#C++ Sorting Algorithm implementation
# C++ Sorting Algorithm implementation

A collection of Sorting Algorithm implemented in C++11. See the `develop` branch for latest version.

## Testing
Tested on g++ 4.8.1 on Ubuntu 13.04 Server and Microsoft Visual Studio 2013RC

###Bubble Sort
### Bubble Sort
A slow a unuseful sorting algorithm for all but the simplest data sets, or for learning about sorting algorithms.

|http://en.wikipedia.org/wiki/Bubble_sort|stable|
Expand All @@ -15,7 +15,7 @@ A slow a unuseful sorting algorithm for all but the simplest data sets, or for l
|Average case performance |O(n^2)
|Space |O(1)

###Cocktail Sort
### Cocktail Sort
aka Bubble Sort, cocktail shaker sort, ripple sort, shuffle sort, shuttle sort or happy hour sort

A Bubble sort variant which is only marginally more performant. Sorting is performed in both directions on each pass of the array.
Expand All @@ -28,15 +28,16 @@ A Bubble sort variant which is only marginally more performant. Sorting is perfo
|Space |O(1)


###Heap Sort
|http://en.wikipedia.org/wiki/Heapsort|unstable|
### Heap Sort

|“http://en.wikipedia.org/wiki/Heapsort”|unstable|
|----|---
|Worst case performance |O(n log n)
|Best case performance |Omega(n), O(n log n)
|Average case performance |O(n log n)
|Worst case space complexity |O(n) total, O(1) auxiliary

##Insertion Sort
### Insertion Sort
An adapted Bubble Sort that alternates between forward and backward passes.

|http://en.wikipedia.org/wiki/Insertion_sort|stable|
Expand All @@ -46,15 +47,15 @@ An adapted Bubble Sort that alternates between forward and backward passes.
|Average case performance |O(n2) comparisons, swaps|
|Worst case space complexity |O(n) total, O(1)|

##Introsort
### Introsort
Introsort is a hybrid sorting algorithm that uses Quick Sort to a recursion depth of O(log n) and then switches to a Heap Sort. Heap Sort is implemented using the standard C++ functions `make_heap` and `sort_heap`, both of which require Random Access data iterators. For maximum flexibility, this implementation of Introsort does not switch to Heap Sort if the data iterators are not Random Access, and can therefore operator on container with any iterator category.

|http://en.wikipedia.org/wiki/Introsort|unstable|
|----|---|
|Worst case performance |O(n log n)|
|Average case performance |O(n log n)|

###Merge Sort
### Merge Sort
A divide and conquer recursive sorting algorithm which respects the original ordering of elements in the data set with identical keys. Two merge sort algorithms are included; 'merge_sort' an inplace sort that sorts a data set within itself, and a 'merge_sort_copy' which produces a secondary data set conatining the sorted result and leave the original unchanged.

|http://en.wikipedia.org/wiki/Mergesort|stable|
Expand All @@ -64,7 +65,7 @@ A divide and conquer recursive sorting algorithm which respects the original ord
|Average case performance |O(n log n)
|Worst case space complexity |O(n) auxiliary

###Min Max Sort
### Min Max Sort
An adapted Selection Sort that finds and repositions the Min and Max elements on each pass.

||unstable|
Expand All @@ -74,7 +75,7 @@ An adapted Selection Sort that finds and repositions the Min and Max elements on
|Average case performance |O(n^2)
|Space |O(1)

###Quick Sort
### Quick Sort
A recursive sorting algorithm that works well with a cache, but is unstable; that is elements with identical keys may appear in a different order in the result than they do in the original data set.

|http://en.wikipedia.org/wiki/Quicksort|unstable|
Expand All @@ -84,7 +85,7 @@ A recursive sorting algorithm that works well with a cache, but is unstable; tha
|Average case performance |O(n log n)
|Worst case space complexity |O(n) auxiliary (naive) O(log n) auxiliary (Sedgewick 1978)

###Selection Sort
### Selection Sort
An inplace comparison sorting algorithm that is slow for large data sets, but it is a simple algorithm and has reasonable performance for inplace algorithms.

|http://en.wikipedia.org/wiki/Selection_sort|stable|
Expand Down