Final Exam Preview Chapter 4,5,6,7,8,9
Remember to evaluate CS221 Go to Ends tonight. Go to Ends tonight.
Final Exam Overview The purpose of these slides is to show you the type of questions and format of questions to be asked on the final exam. Wednesday, December 12, 2007 8:00 – 9:50 a.m. Closed Book(s). You may have one 8-1/2 x 11 inch paper with hand written notes both sides. The purpose of these slides is to show you the type of questions and format of questions to be asked on the final exam. Wednesday, December 12, 2007 8:00 – 9:50 a.m. Closed Book(s). You may have one 8-1/2 x 11 inch paper with hand written notes both sides.
Evaluate the following: * * + * * +
Convert the following to postfix (8 + 2) * (1 – 5) (8 + 2) * (1 – 5)
Given this list, what does code do? (Assume nmbr is 3)
Draw the list as it appears after the code runs.
Draw your maze stack.
Answer the following: What is the advantage of using a linked list for a stack rather than an array? What is the “run-time stack”? What is an “activation Frame”? Show the run-time stack for the running of a recursive program like (sum of integers). Show a stack used to evaluate whether “race car” is a palindrome? What is FIFO? What is LIFO? Give a practical example of a queue used in a computer operating system. What is the advantage of using a linked list for a stack rather than an array? What is the “run-time stack”? What is an “activation Frame”? Show the run-time stack for the running of a recursive program like (sum of integers). Show a stack used to evaluate whether “race car” is a palindrome? What is FIFO? What is LIFO? Give a practical example of a queue used in a computer operating system.
Do the following: Draw a doubly linked list with four nodes? List two advantages of being doubly linked. Convert your doubly linked list into a circularly linked list. Draw a linked list of binary search trees (each tree to only 3 levels). Show at least three trees. Prove ??? Using induction. Draw rough code for a pre-order traversal of a ternary tree. Draw a doubly linked list with four nodes? List two advantages of being doubly linked. Convert your doubly linked list into a circularly linked list. Draw a linked list of binary search trees (each tree to only 3 levels). Show at least three trees. Prove ??? Using induction. Draw rough code for a pre-order traversal of a ternary tree.
Given string “RayBabcock” what prints if code is run? public static void printCharsFunny(String str) { if (str == null || str.equals("")) { return; } else { printCharsFunny(str.substring(1)); System.out.println(str.charAt(0)); }
Write the three traversals.
Prove by Induction N^2 – n – 1 > 0 for n >= 2
Prove by Induction N^2 – n – 1 > 0 for n >= 2 Base Case: n = 2 2^2 – 2 – 1 > 0 1 > 0 N^2 – n – 1 > 0 for n >= 2 Base Case: n = 2 2^2 – 2 – 1 > 0 1 > 0
Prove by Induction N^2 – n – 1 > 0 for n >= 2 Base Case: n = 2 2^2 – 2 – 1 > 0 1 > 0 Assume true n <= N. Need to show for N+1. N^2 – n – 1 > 0 for n >= 2 Base Case: n = 2 2^2 – 2 – 1 > 0 1 > 0 Assume true n <= N. Need to show for N+1.
Prove by Induction N^2 – n – 1 > 0 for n >= 2 Base Case: n = 2 2^2 – 2 – 1 > 0 1 > 0 Assume true n <= N. Need to show for N+1. (N+1)^2 – (N+1) – 1 = N^2 + 2N + 1 – N – 1 – 1 = N^2 + N – 1 > N^2 – N – 1 > 0 by inductive hypothesis N^2 – n – 1 > 0 for n >= 2 Base Case: n = 2 2^2 – 2 – 1 > 0 1 > 0 Assume true n <= N. Need to show for N+1. (N+1)^2 – (N+1) – 1 = N^2 + 2N + 1 – N – 1 – 1 = N^2 + N – 1 > N^2 – N – 1 > 0 by inductive hypothesis
Is this a Heap?
What Kind of Heap Now?
Do the set operations.
Using hash function given, hash these values into the table.
I reserve 10% as a surprise. ??