cse101-wi12-Week2Discussion

cse101-wi12-Week2Discussion - 2 ) What is the time...

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

View Full Document Right Arrow Icon
CSE 101 - Discussion Homework Questions, Examples, Master Theorem
Background image of page 1

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

View Full DocumentRight Arrow Icon
Agenda First 25 minutes (max) for homework questions. Due tomorrow at the START of lecture! Chapter 3 example problem Divide and conquer: Master theorem
Background image of page 2
Chap. 3, Ex. 3.14 Chapter 3 suggests an algorithm for linearization (topological sorting), which repeatedly removes source nodes from the graph (page 101). Show that this algorithm can be implemented in linear time. Hint: What do we know about the indegree of source nodes? How quickly can we Fnd the indegree of all nodes in the graph?
Background image of page 3

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

View Full DocumentRight Arrow Icon
Master Theorem Simple method for providing the time complexity (big- O ) of a recurrence relation. Divide and conquer! Page 49 in Algorithms
Background image of page 4
Master Theorem What is a ? What is b ?
Background image of page 5

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

View Full DocumentRight Arrow Icon
Master Theorem Mergesort T(n) = 2T(n/2) + O(n) What is the time complexity of Mergesort?
Background image of page 6
Master Theorem T(n) = 2T(n/2) + O(n
Background image of page 7

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

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

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

View Full DocumentRight Arrow Icon
Background image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 2 ) What is the time complexity? Master Theorem T(n) = 4T(n/4) + O(1) What is the time complexity? Master Theorem T(n) = T(sqrt(n)) + O(1) Can you solve these with the master theorem? T(n) = T(n-1) + O(n) Closing Riddle A bunch of people are living on an island when a visitor comes and tells them that everyone with blue eyes must leave as soon as possible. There is a Fight out every evening at 8 pm. Every person can see everyone elses eye color but not their own (and no telling each other. ..) Its not known how many people have blue eyes except that at least one person must. How many days will it take the blue eyed people to leave the island? Hint: What happens when one person has blue eyes? Do they know? rom Cracking the Coding Interview (McDowell, 2011)...
View Full Document

This note was uploaded on 01/20/2012 for the course ECE 101 taught by Professor Siegel during the Spring '08 term at UCSD.

Page1 / 10

cse101-wi12-Week2Discussion - 2 ) What is the time...

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

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