您的位置:首页 > 产品设计 > UI/UE

Lecture 4 Quick Sort and Randomized Quick Sort

2018-08-12 15:42 369 查看
Quick Sort

--Divide and Conquer

--Sorts “in place”

--Very practical with tuning

Divide and Conquer:

1.Divide: Partition array into 2 sub-arrays around pivot x such that elements in lower sub-array <= x <= elements in upper sub-array;

2.Conquer: Recursively sort 2 sub-arrays;

3.Combine: Trivial.





Randomized Quick sort:

--running time is independent of input ordering.

--no assumption about input distribution.

--no specific input elicit the worst-case behavior.

--the worst case determined only by random number generator.



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  DivideAndConquer Pivot