



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




U.C. Berkeley โ CS170: Algorithms Midterm 1 Lecturers: Umesh Vazirani & Christos Papadimitriou February 26, 2004
Answer all questions. Read them carefully first. Be precise and concise. The number of points indicate the amount of time (in minutes) each problem is worth spending. Write in the space provided, and use the back of the page for scratch. Good Luck!
1
2 3 total
(15 points) Do a depth-first search of the graph below. Follow our convention of processing nodes in lexicographic order. Show the pre and post order numbers. How many strongly connected components are there (no need to show how to find them). What is the graph after you shrink them?
boring(n) if n > 1 do: {print(โare we done yet?โ); boring(n/2); boring(n/2)}