Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 19 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
19
Dung lượng
2,36 MB
Nội dung
Master Method Proof (Part 1) Design and Analysis of Algorithms I The Master Method Assume : recurrence is I ( For some constant c ti II And n is a power of b (general case is similar, but more tedious ti Idea : generalize MergeSort analysis (i.e., use a recursion tree ti Nextcore AI Gopal Shangari THE RECURSION TREE Level Level Level logbn a braches Base cases (size 1ti Work at a Single Level Total work at level j [ignoring work in recursive calls] Total Work Summing over all levels j = 0,1,2,…, logbn : Total work Design and Analysis of Algorithms I Master Method Intui3on for the Cases Nextcore AI Gopal Shangari HOW TO THINK ABOUT (*) Interpreta3on a = rate of subproblem prolifera3on (RSP) bd = rate of work shrinkage (RWS) (per subproblem) Nextcore AI Gopal Shangari Which of the following statements are true? (Check all that apply.ti INTUITION FOR THE CASES RSP = RWS => Same amount of work each level (like [expect Merge dlog(nti] RSP < RWS => less work eachO(n level => most work at the Sortti [might expect root dti] => most work at O(n RSP > RWS => more work each level the leaves [might expect O(# leavesti] Nextcore AI - Gopal Shangari Master Method Proof (Part II) Design and Analysis of Algorithms I THE STORY SO FAR/CASE = for all j =1 = (logbn + 1) [ end Case ] Nextcore AI Gopal Shangari Basic Sums Fact For , we have Proof : by induction (you check) Upshot: If r