This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: HW8F07 CS336 1. Prove or disprove that if f is Θ( g ) and s 6 = 0 is a constant then sf is Θ( g ). Solution: Since f = Θ( g ), there exist C 1 ,C 2 ,k such that C 1  g ( x )  ≤  f ( x )  ≤ C 2  g ( x )  , ∀ x ≥ k If  s  ≥ 1, Let C 2 =  s  · C 2 . Then C 1  g ( x )  ≤  f ( x )  ≤  s · f ( x )  =  s · f ( x )  ≤  s  C 2  g ( x )  = C 2  g ( x )  , ∀ x ≥ k If  s  < 1, Let C 1 =  s  · C 1 . Then C 1  g ( x )  ≤  s  · C 1  g ( x )  ≤  s  ·  f ( x )  =  s · f ( x )  ≤ C 2  g ( x )  , ∀ x ≥ k 2. Give a big O estimate for ( n +3 n 2 )(log n !+2 n +log n 3 ). For your estimate, use the simplest function of the smallest order. Solution: O ( n 2 · 2 n ) 3. Prove that every nonempty, full binary tree has an odd number of nodes. Recall, with our definition, that a full tree is one in which every node has either 0 or 2 children. Solution: We will prove this by induction on the height of the tree. For the base case, we have h = 0 and t = ( d, ∅ , ∅ ). This tree has 1 node, which is an odd number. For the inductive step, the I.H. is the following: for full binary trees of height k ≤ h , the number of nodes is odd. We need to show that for a binary full tree of height h + 1, the number of nodes is odd....
View
Full
Document
This note was uploaded on 09/20/2008 for the course CS 336 taught by Professor Myers during the Spring '08 term at University of Texas at Austin.
 Spring '08
 Myers

Click to edit the document details