2 - Computer Science C73 Scarborough Campus Homework...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science C73 October 10 2007 Scarborough Campus University of Toronto Homework Assignment #2 Due: October 24 2007, by 12 noon (in the course drop box) Appended to this document is a cover page for your assignment. Fill it out, staple your answers to it, and deposit the resulting document into the course drop box. Please do not enclose your assignment in an envelope. Question 1. (10 marks) Solve Exercise 1 on page 246 of the textbook. You should not only describe your algorithm, but also explain why it works and why it achieves the required bound of O (log n ) queries. Question 2. (10 marks) The standard algorithm for merging two sorted lists requires time proportional to the size of the resulting list. Suppose we are given k sorted lists, each containing n elements. We want to merge these into a single sorted list. a. (5 marks) Here is one algorithm to solve our problem: We merge the Frst two lists; then we merge the resulting list with the third list; then we merge the resulting list with the fourth list, etc. What is the time complexity of this algorithm in terms of k and n ? b. (5 marks) Give a more e±cient divide-and-conquer algorithm to solve this problem. What is the time complexity of your algorithm? Question 3. (10 marks) If G = ( V,E ) is a graph and V V , the subgraph of G induced by V is the graph G = ( V ,E ), where E = { ( u,v ) E : u,v V } . Intuitively, this is the graph we obtain from G if we delete all nodes except those in V and all edges that have (at least) one endpoint outside of V .
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/10/2009 for the course RLG 100 taught by Professor Pearly during the Spring '08 term at University of Toronto- Toronto.

Page1 / 3

2 - Computer Science C73 Scarborough Campus Homework...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online