finalFall02 - Points off 1 2 3 4 Admin Total off Net Score...

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

View Full Document Right Arrow Icon
Points off 1 2 3 4 Admin Total off Net Score CS 307 – Final Exam– Fall 2002 Name____________________________________ Last 4 digits of SSN / Student ID ______________ Section Leaders Name ___________________________ Instructions: 1. There are 4 questions on this test. Question 1 is worth 40 points; all others are worth 20 points each. 2. You have 3 hours to complete the test. 3. You may not use a calculator. 4. When code is required, write Java code. 5. You may not use any classes or methods from the Java Standard Library other than the ones specifically mentioned on each question. 6. The style guide is not in effect except where noted 7. Please make your answers legible. 1. Short answer questions. (2 points each) Write the answer to each question in the space provided. If code results in an error indicate if it is a compile error or runtime error. A. The following numbers are inserted in the order shown into a binary search tree with no checks to ensure or maintain balance. The tree is initially empty. Draw the resulting tree. 195 156 20 68 162 150 CS 307 – Final Exam – Fall 2002 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
For parts B, C, and D consider the following binary tree. For each question assume when a node is processed the value in the node is printed out by the statement: System.out.print( currentNode.data + " " ); B. What is the output of a preorder traversal of the tree? ____________________________________________________ C. What is the output of an inorder traversal of the tree? ____________________________________________________ D. What is the output of a postorder traversal of the tree? ____________________________________________________ E. Is the tree on page 2 a binary search tree? CS 307 – Final Exam – Fall 2002 2 -42 -5 -22 161 81 135 32 138 root of tree
Background image of page 2
F. In a priority queue each element enqueued is placed in front of all elements already in the queue that have a lower priority, but behind all elements already in the queue that have a higher or equal priority? If the internal storage container for the priority queue is a doubly linked list with a head and tail reference what is the average case Big O for enqueueing an item to the priority queue? ________________________ G. What is the worst case Big O for inserting N items into an initially empty Binary search Tree with no checks or procedures to maintain balance? ________________________ H. What is the worst case Big O for inserting N items into an initially empty Red Black tree? ________________________________________________________ I. Consider the list data structure. A particular list uses an array as its internal storage container. When the container is full the array is always resized with space for 10 additional elements. What is the average case Big O for the default add operation, which always adds the new element to the end of the list? Give a brief explanation of your answer. ________________________________________________________ CS 307 – Final Exam – Fall 2002
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

finalFall02 - Points off 1 2 3 4 Admin Total off Net Score...

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

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