ass03 - (a) Prove that the number of subtrees of a complete...

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

View Full Document Right Arrow Icon
Fall 2011 CS 513: #3 Farach-Colton Due by the beginning of class, Sept. 27. 1. Suppose that you are given an k -sorted array, in which no element is farther than k positions away from its final (sorted) position. Give an algorithm which will sort such an array. Prove its correctness. Analyse its running time. Note: your algorithm should run faster than Θ( n log n ), that is, it should take advantage of the fact that the array is almost sorted. 2. Consider once again the k -sorted array of the previous problem. Show that any comparison based algorithm for sorting an almost sorted array makes Ω( n log k ) com- parisons. 3. Prove that if an n node graph has two of the following properties, it has the third: (a) It has n - 1 edges. (b) It is connected. (c) It is accyclic. 4. Define a subtree of be any connected subgraph of a tree (this is diferent than the definition in the book).
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (a) Prove that the number of subtrees of a complete binary tree is not polynomial in the number of nodes. (b) Give an example of a class of trees { T n } where the number of subtrees is a polynomial in the number of nodes. 5. Let F i be the i th Fibonacci number (that is F (0) = 0 ,F (1) = 1 ,F ( n + 2) = F ( n ) + F ( n + 1)). Show that F n +2 = 1 + n i =0 F i . 6. Show that if you have a polynomial time algorithm for Hamiltonian Path, that you have a polynomial time algorithm for sorting. 7. The Bounded Degree Spanning Tree (BDST) problem is the following: Input: Graph G and integer k . Output: Yes, if G has a spanning tree where every node has degree at most k , No, otherwise. Suppose there is no polynomial time algorithm for Hamilonian Path. Show that there is no polynomial time algorithm for BDST....
View Full Document

Ask a homework question - tutors are online