Introduction to Algorithms Second Edition Instructor’s Manual 2nd phần 1 pptx
... Notes 12 -1 Solutions 12 -12 Chapter 13 : Red-Black Trees Lecture Notes 13 -1 Solutions 13 -13 Chapter 14 : Augmenting Data Structures Lecture Notes 14 -1 Solutions 14 -9 Preface This document is an instructor’s ... 26.4-2, 26.4-3, and 26.4-6 and to Problems 12 -3 and 17 -4. Made minor changes in the solutions to Problems 11 -2 and 17 -2. Affected chapters: Chapters 5,...
Ngày tải lên: 13/08/2014, 18:20
... ball } = n n 1 1 − 1 n n 1 1 n 1 = n · 1 − 1 n n 1 1 n = 1 − 1 n n 1 , and so E [ X ] = n i =1 1 − 1 n n 1 = n 1 − 1 n n 1 . Because n 1 − 1 n n 1 = n ( 1 − 1 n ) n 1 − 1 n , as ... 5. • MAX-HEAPIFY is applied to subtrees rooted at nodes (in order): 16 , 2, 3, 1, 4. 1 23 4567 8 910 1 23 4567 8 910 4 13 2 9...
Ngày tải lên: 13/08/2014, 18:20
... > ≤ > 1: 2 2:3 1: 3 1, 2,3〉 1: 3 〈2 ,1, 3〉 2:3 1, 3,2〉 〈3 ,1, 2〉 〈3,2 ,1 ≤ > ≤ > ≤ > 〈2,3 ,1 A [1] ≤ A[2] A [1] > A[2] (swap in array) A [1] ≤ A[2] A[2] > A[3] A [1] > A[2] A [1] > ... = d dq ln q − ln(n − q − 1) ln 2 = 1 ln 2 1 q + 1 n − q − 1 f n − 1 2 = 1 ln 2 2 n − 1 + 2 n − 1 = 1 ln 2 · 4 n − 1 > 0 (sin...
Ngày tải lên: 13/08/2014, 18:20
Introduction to Algorithms Second Edition Instructor’s Manual 2nd phần 4 pot
... is E 1 n n i =1 1 + n j=i +1 X ij = 1 n n i =1 1 + n j=i +1 E [ X ij ] (linearity of expectation) = 1 n n i =1 1 + n j=i +1 1 m = 1 + 1 nm n i =1 (n −i ) = 1 + 1 nm n i =1 n ... 11 : Hash Tables 11 -19 h(x) − h(y) = n 1 i=0 x i 2 ip mod (2 p − 1) − n 1 i=0 y i 2 ip mod (2 p − 1) . Since 0 ≤ h(x), h(y)<2 p 1, w...
Ngày tải lên: 13/08/2014, 18:20
Introduction to Algorithms Second Edition Instructor’s Manual 2nd phần 5 potx
... Chapter 12 : Binary Search Trees 12 -11 We solve the recurrence by induction on n. Basis: n = 1. 1 = Y 1 = E [ Y 1 ] ≤ 1 4 1 + 3 3 = 1 4 · 4 = 1 . Inductive step: Assume that E [ Y i ] ≤ 1 4 i ... Red-Black Trees 13 -5 4 7 11 918 14 17 19 22 x y 4 7 18 19 14 17 22 x y 11 9 LEFT-ROTATE(T, x) • Before rotation: keys of x’s left subtree ≤ 11 ≤ keys of y’...
Ngày tải lên: 13/08/2014, 18:20
Introduction to Algorithms Second Edition Instructor’s Manual 2nd phần 6 pps
... cases to examine. Case 1: z’s uncle is red. C DA B α βγ δε (a) C DA B α βγ δε C DB δε C D B A αβ γδε (b) A αβ γ k +1 k +1 k +1 k +1 k +1 k+2 k +1 k +1 k +1 k +1 k +1 k +1 k +1 k +1 k+2 k+1z y z y 14 -16 Solutions ... Chapter 15 : Dynamic Programming 15 -5 FASTEST-WAY (a, t, e, x, n) f 1 [1] ← e 1 + a 1, 1 f 2 [1] ← e 2 + a 2 ,1 for j ← 2 to n do if f 1 [ j − 1]...
Ngày tải lên: 13/08/2014, 18:20
Introduction to Algorithms Second Edition Instructor’s Manual 2nd phần 7 ppsx
... (D i 1 ) ≤ k ln n i 1 + kn i ln n i − kn i 1 ln n i 1 = k ln n i 1 + k(n i 1 − 1) ln(n i 1 − 1) − kn i 1 ln n i 1 = k ln n i 1 + kn i 1 ln(n i 1 − 1) − k ln(n i 1 − 1) − kn i 1 ln n i 1 = k ... Show costs later.] counter A value 2 1 0 cost 0 000 0 1 0 01 1 2 010 3 3 011 4 4 10 0 7 5 10 1 8 6 11 0 10 7 11 1 11 0 000 14 . . . . . . 15 Cost of I NCREMENT = (...
Ngày tải lên: 13/08/2014, 18:20
Introduction to Algorithms Second Edition Instructor’s Manual 2nd phần 8 potx
... Graph Algorithms 22-5 Example: [Go through this example, adding in the d and f values as they’re com- puted. Show colors as they change. Don’t put in the edge types yet.] 12 1 43 11 8 65 16 13 15 14 72 10 9 T T T T T T B F CC C C C C df Time ... of trees. • 1 tree per set. Root is representative. • Each node points only to its parent. Solutions for Chapter 21: Data Structures for D...
Ngày tải lên: 13/08/2014, 18:20
Introduction to Algorithms Second Edition Instructor’s Manual 2nd phần 9 pdf
... t (k 1) kj . T RANSITIVE-CLOSURE(E, n) for i ← 1 to n do for j ← 1 to n do if i = j or (i, j) ∈ E[G] then t (0) ij ← 1 else t (0) ij ← 0 for k ← 1 to n do for i ← 1 to n do for j ← 1 to n do ... relax the edges (u 0 , u 1 ), (u 1 , u 2 ), ,(u l 1 ,v 0 ), (v 0 ,v 1 ), (v 1 ,v 2 ), ,(v k 1 ,v 0 ), (v 0 ,v 1 ), (v 1 ,v 2 ), ,(v k 1 ,v 0 ), (v 0 ,v 1 ), (...
Ngày tải lên: 13/08/2014, 18:20
Introduction to Algorithms Second Edition Instructor’s Manual 2nd phần 10 potx
... 15 .4-4, 15 - 21 Exercise 16 .1- 2, 16 -9 Exercise 16 .1- 3, 16 -9 Exercise 16 .1- 4, 16 -10 Exercise 16 .2-2, 16 -11 Exercise 16 .2-4, 16 -12 Exercise 16 .2-6, 16 -13 Exercise 16 .2-7, 16 -13 Exercise 16 .4-2, 16 -14 Exercise ... 14 .1- 7, 14 -9 Exercise 14 .2-2, 14 -10 Exercise 14 .2-3, 14 -12 Exercise 14 .3-3, 14 -13 Exercise 14 .3-6, 14 -13 Exercise...
Ngày tải lên: 13/08/2014, 18:20