Presentation is loading. Please wait.

Presentation is loading. Please wait.

Final Exam Preview Chapter 4,5,6,7,8,9. Remember to evaluate CS221  Go to  Ends tonight.

Similar presentations


Presentation on theme: "Final Exam Preview Chapter 4,5,6,7,8,9. Remember to evaluate CS221  Go to  Ends tonight."— Presentation transcript:

1 Final Exam Preview Chapter 4,5,6,7,8,9

2 Remember to evaluate CS221  Go to http://www.cs.montana.edu/surveyhttp://www.cs.montana.edu/survey  Ends tonight.  Go to http://www.cs.montana.edu/surveyhttp://www.cs.montana.edu/survey  Ends tonight.

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

4 Evaluate the following:  7 + 8 * 9 - 3  12 24 10 * +  7 + 8 * 9 - 3  12 24 10 * +

5 Convert the following to postfix  (8 + 2) * (1 – 5)  1 + 2 + 3 + 4 + 5 + 6  (8 + 2) * (1 – 5)  1 + 2 + 3 + 4 + 5 + 6

6 Given this list, what does code do? (Assume nmbr is 3)

7 Draw the list as it appears after the code runs.

8 Draw your maze stack.

9 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 4 + 3 + 2 + 1 (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 4 + 3 + 2 + 1 (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.

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

11 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)); }

12 Write the three traversals.

13 Prove by Induction  N^2 – n – 1 > 0 for n >= 2

14 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 

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

16 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

17 Is this a Heap?

18 What Kind of Heap Now?

19 Do the set operations.

20 Using hash function given, hash these values into the table.

21 I reserve 10% as a surprise.  ??


Download ppt "Final Exam Preview Chapter 4,5,6,7,8,9. Remember to evaluate CS221  Go to  Ends tonight."

Similar presentations


Ads by Google