Sorting data structure principle

First, the principle of decomposition sort

1, insertion sort

Time complexity of O (n * n), the spatial complexity is O (1), stable

 

2. Select Sort

Time complexity of O (n * n), the spatial complexity is O (1), unstable

 3, merge sort 

The time complexity of O (nlogn), the spatial complexity of O (n), stable

4, Quick Sort

The time complexity of O (nlogn), the spatial complexity is O (1), unstable

 

 5, bucket sort

Time complexity of O (n), back extreme cases people O (n + logn), the space complexity O (M + N), N number of elements, the number M of the tub, unstable

6, counting sequencing

Time complexity of O (n), back extreme cases people O (n), the spatial complexity of O (n), stable

Released nine original articles · won praise 3 · Views 677

Guess you like

Origin blog.csdn.net/xj_hnust/article/details/104498272