{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

SolHW8f07 - HW8F07 CS336 1 Prove or disprove that if f is(g...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
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 0 2 = | s | · C 2 . Then C 1 | g ( x ) | ≤ | f ( x ) | ≤ | s |·| f ( x ) | = | s · f ( x ) | ≤ | s | C 2 | g ( x ) | = C 0 2 | g ( x ) | , x k If | s | < 1, Let C 0 1 = | s | · C 1 . Then C 0 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. Let t = ( d, l, r ) be a full binary tree of height h + 1. Then l and r must both be full binary trees of height h . (They can’t be because our tree is of height h + 1.) 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Then we have # N ( t ) < t = ( d, l, r ) > = # N ( d, l, r ) < # N. 1 > = 1 + # N ( l ) + # N ( r ) < I.H., let p
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern