COP3530SampleQuiz2

# COP3530SampleQuiz2 - COP 3530 CS3 15 1 Fall 1999 Quiz 2...

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

COP 3530 – CS3 Fall 1999 Quiz # 2 Name:__ Sample Quiz _________ 15 1. Consider the following trees being used to represent equivalence classes ( partitions ) over the set {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16} . Show the resulting combination of the first two trees if we do a union(2,3) . Now show the final tree the results after we do a union(6,16) . In each case, assume that the union starts with two finds , each of which uses path compression and that the unions use tree heights to minimize path lengths . 4 6 2 8 5 1 3 7 9 14 11 13 16 12 15 10 Define the function lg* N (also called log 2 *(N) ). What is the value of lg* 2 16 ? How does lg* N relate to the management of partition trees by the above algorithms? 10 2. The following table shows algorithmic costs for naive approaches (ones not involving sorts or indices) to relational operations. Fill in the columns associated with the use of indices . You may assume constant time index lookup via a hash table. Assume |R| = n , |S| = m , t = n+m , and |Result| = k Naive Indexed R S n × m R – S n × m σ C (R) n π (R) n^2 R S n × m 10 3. An undirected graph can be checked to see if it’s connected by using a union/find algorithm, similar to Kruskal’s tree spanning algorithm (see #7 ), or by employing depth first search . In words, describe how the depth first search algorithm solves this problem. You may assume a graph G

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern