0% found this document useful (0 votes)
181 views1 page

Comp 251 Assignment 3

This document contains 4 problems related to algorithms and data structures: 1) Developing an O(log n) algorithm for computing the Fibonacci sequence using a matrix relationship and proof by induction. 2) Analyzing binary search recurrence relations and proving by induction that the exact formula is T(n) = 1 + log n. 3) Solving problem 5.11 in a computer graphics text about the skyline problem. 4) Analyzing heap sort, including proving bottom-up heap construction takes O(n) time and that a summation of logs is Ω(n log n).

Uploaded by

dergachev
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PS, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
181 views1 page

Comp 251 Assignment 3

This document contains 4 problems related to algorithms and data structures: 1) Developing an O(log n) algorithm for computing the Fibonacci sequence using a matrix relationship and proof by induction. 2) Analyzing binary search recurrence relations and proving by induction that the exact formula is T(n) = 1 + log n. 3) Solving problem 5.11 in a computer graphics text about the skyline problem. 4) Analyzing heap sort, including proving bottom-up heap construction takes O(n) time and that a summation of logs is Ω(n log n).

Uploaded by

dergachev
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PS, PDF, TXT or read online on Scribd
You are on page 1/ 1

Data Structures and Algorithms COMP-251 A

Problem Assignment 3

1. Algorithms for the Fibonacci Function


The following matrix relationship between a matrix power and the Fibonacci sequence
leads to an O(log n) time algorithm for computing f(n).

n
1 1 = f (n + 1) f (n)
1 0 f (n) f (n – 1)

Prove by induction that this relation holds for all n greater than one.

2. Binary Search
The recurrence relations for the total number of comparisons done in binary search in the
worst case are given by T(n) = 1 for n=1, and for all n>1 by:

T ( n ) = 1 + T  n--- 
 2 

Prove by induction on n that the exact formula for the solution to these recurrence equa-
tions is given by:
T ( n ) = 1 + log n

3. The Skyline Problem in Computer Graphics


Problem 5.11 in the Udi Manber text.

4. Analysis of Heap Sorting


(a) Prove that bottom-up heap construction with n keys takes O(n) time.
(b) Show that

∑ log i = Ω ( n log n )
i=1

-1-

You might also like