ass01 - G is unique). 6. Suppose there is a C++ library on...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Fall 2011 CS 513: #1 Math Fundamentals Farach-Colton Due by the beginning of class, Sept. 13. 1. Prove: A binary tree with n nodes has depth at least b log n c and at most n - 1. (Hint: Show that if a binary tree has depth d and has n nodes, then n 2 d +1 - 1.) 2. Prove that log( n !) Θ( n log n ). 3. Prove by induction on k : (Remember these formulas, they may be used later) (a) k i =1 i ( i + 1) = 1 3 k ( k + 1)( k + 2) (b) k i =0 i 2 i = ( k - 1)2 k +1 + 2 (c) k i =0 i 2 i = 2 - k +2 2 k 4. Place the following functions into increasing asymptotic order. If two or more of the functions are of the same asymptotic order, then indicate this. Prove the correctness of your ordering. (In other words, if you claim that g ( n ) is greater than f ( n ) then show that f ( n ) O ( g ( n )) but f ( n ) is not in Θ( g ( n )). 4 n, n 2 , n log n, n ln n, lg n, e n Note: log means logarithm base 2, and ln means logarithm base e (natural log). 5. Let G = ( V,E,W ) be a weighted graph such that no two different edges in E have the same weight ( e 1 ,e 2 E,e 1 6 = e 2 W ( e 1 ) 6 = W ( e 2 )). Prove that G has a unique unrooted minimal spanning tree (The set of edges participating in an MST for
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: G is unique). 6. Suppose there is a C++ library on your machine which has the following function: HamC ( G ) : Input: Graph G Output: Yes, if G has a simple cycle which traverses all nodes; No, otherwise. Such a cycle is known as a Hamiltonian Cycle . Let HamC ( G ) implement the above routine. Suppose further, that HamC () runs in polynomial time, that it, it runs in time O ( n c ) for some constant c on an n node graph. A Hamiltonian Path from u to v is a simple path from u to v which traverses all the nodes of a graph. Your mission is to write an algorithm with the following input and output: HamP ( G,u,v ) : Input: Graph G , and nodes u and v in G . Output: Yes, if there is a Hamiltonian Path from u to v in G ; No otherwise. Your algorithm should run in polynomial time. (Hint: You’ll have a tough time doing this without using the HamC () subroutine.)...
View Full Document

This document was uploaded on 12/18/2011.

Ask a homework question - tutors are online