Final Exam Review Session Details and Question Overviews
260 likes | 356 Vues
Get ready for the final exam with essential review session information and comprehensive question previews. Don't miss out on key tips! Review notes available for assistance.
Final Exam Review Session Details and Question Overviews
E N D
Presentation Transcript
Final Exam Review 6 December 2010
Assignment #5 • Will be due tonight @ 11:59 p.m. • Take a look at my “Review Notes” if you still have no idea how to approach the problem • Stars in cells with no dependencies • Runtime issue • We will not impose runtime constraints, but you have to use backtracking • Be aware that we will do less bug-fixing
Final Exam Information • On Monday, 13 December @ 4:00 p.m. – 6:50 p.m. (NOT 4:30 p.m.) • You are allowed 3 sheets of letter-sized paper with notes • Review Sessions: • Tuesday, 7 December @ 1:00 p.m. – 3:00 p.m. in HEC 101 with Remo • Wednesday, 8 December @ 1:00 p.m. – 3:00 p.m. in HEC 101 with Chris
Review Question 1 • Network Flow • Proposed Solution:
Review Question 1 • Counter Example: • Maximum Flow will be 10 • BUT: book is “split up” between boxes x1 and x2
Review Question 2 • Edit Distance • Remember:
Review Question 3 • Backtracking • You are given a set of letters, in random order, e.g. “OFCEFI” • You have to determine whether or not there exists a way to reorder those letters to form a valid word. • Given: A function “startswith(a)”, that determines if there are any words that start with the string “a”
Review Question 3 • Backtracking function jumbledLetters(a, b) takes in a set of letters, a, already ordered, and set of letters, b, that needs to be added • Base Cases: • If startswith(a) == FALSE, return FALSE • If b is empty string, return startswith(a) • Recursively call jumbledLetters()with next set of letters • If any of recursive calls return TRUE, return TRUE • If all return FALSE, return FALSE
Review Question 3 • Example: • Call to jumbledLetters(“OF”, “CEFI”)
Review Question 4 • Single Room Scheduling (Lecture 11) • Greedy Solution: • Sort the requests by finish time. • Go through the requests in order of finish time, scheduling them in the room if the room is unoccupied at its start time.
Review Question 5 • MakeHeap (Lecture 4) • Place all the unsorted elements in a complete binary tree. • Going through the nodes in backwards order, and skipping the leaf nodes, run Percolate Down on each of these nodes. • If one of the children is less than the node, swap the lowest. • Continue until node has only larger (or equal) children or until leaf node
Review Question 5 • Initial Heap:
Review Question 5 • Final Heap:
Review Question 6 • Solution:
Review Question 6 • Usually a good idea to break down initial equation as much as possible before proceeding
Review Question 7 • Code Analysis • What problem does this code solve? • Symbolically, what does the variable “m” represent? Matrix Chain Multiplication At which matrix you want to split your multiplication a the top level.
Review Question 7 • Explain conceptually what is stored in the variables “one”, “two”, and “three”. • Is the method “function” efficient? Justify. • “one” stores number of multiplications to do the left-side product • “two” stores number of multiplications to do the right-side product • “three” stores number of multiplications to take the two products from two recursive calls and multiply them No. The exact same recursive call gets made multiple times.
Review Question 9 • Which row (0 – 9) is this in the path array? • Determine the vertices traversed in the shortest path from vertex 3 to vertex 0. • From the information given, can we determine which vertex is farthest away from vertex 3? Why or why not? 3 3 7 6 2 0 No. Because of insufficient weight info.
Review Question 10 • CHEESE!