| Name | Best | Average | Worst | Memory | Stable | Method | Other notes |
|---|---|---|---|---|---|---|---|
| Insertion sort | ![]() | ![]() | ![]() | ![]() | Yes | Insertion | Average case is also , where d is the number of inversions |
| Binary tree sort | — | ![]() | ![]() | ![]() | Yes | Insertion | When using a self-balancing binary search tree |
| Cycle sort | — | ![]() | ![]() | ![]() | No | Insertion | In-place with theoretically optimal number of writes |
| Selection sort | ![]() | ![]() | ![]() | ![]() | No | Selection | Its stability depends on the implementation. Used to sort this table in Safari or other Webkit web browser [2]. |
| Bubble sort | ![]() | ![]() | ![]() | ![]() | Yes | Exchanging | Tiny code |
| Merge sort | ![]() | ![]() | ![]() | Depends | Yes | Merging | Used to sort this table in Firefox [3]. |
| Quicksort | ![]() | ![]() | ![]() | ![]() | Depends | Partitioning | Can be implemented as a stable sort depending on how the pivot is handled. Naïve variants use space |
Thursday, November 25, 2010
Sorting
from wikipedia:
Subscribe to:
Post Comments (Atom)



, where d is the number of 


space
No comments:
Post a Comment