Compare the time complexity and space complexity of sorting algorithms

If the picture is infringing, contact me to delete it immediately.

The above is the " comparative sort " method. Here I call bubble sort, simple selection sort, and direct insertion sort as simple sort.

Then, the following memory can be made:

  • Average time complexity: Simple sorting is O (n ^ 2), others are O (nlogn), Hill sorting is slightly different.
  • Stability: Quick selection of Greek piles , unstable. Quick sort, Hill sort, heap sort.
  • Best case: bubbling and direct insertion are the best, simple selection is the worst. Simple ranking covers the best and worst.
  • Worst case: Heap sort and merge sort O (nlogn), others are O (n ^ 2).

 

 

 

Guess you like

Origin blog.csdn.net/weixin_36389889/article/details/105199402