Fall01Final - 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 2001 Name____________________________________ Last 4 digits of SSN / Student ID ______________ Class Unique ID ___________________________ Instructions: 1. There are 4 questions on this test. Question 1 is worth 60 points, all others are worth 20 points 2. You will 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. 7. Please make your answers legible. 1. Java mechanics and 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. 15 86 90 12 45 2 8 CS 307 – Final Exam – Fall 2001 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 a inorder traversal of the tree? ____________________________________________________ D. What is the output of a postorder traversal of the tree? ____________________________________________________ CS 307 – Final Exam – Fall 2001 2 11 12 13 39 7 571 2001 2010 28 101
Background image of page 2
E. Assume we are implementing a hash table with an array of linked lists as the storage container. Assume chaining is used to resolve collisions. Objects that hash to the same value are simply placed at the end of the linked list at the index the key hashes to. The table is rehashed whenever any chain reaches a length of 10. What is the average case and worst case Big O for inserting an element into the table? (Assume keys are unique, and the hash function does a good job of distributing the keys over the indexes of the array used as storage.) Average _______________________ Worst _______________________ F. If the same hash table described in part E is used what is the Big O of accessing an element in the hash table? ________________________ G. Assume a hash table uses strings consisting of only lower case letters as the keys for inserting items into the table. The hash function assigns an integer to each character in the string, 1 for 'a', 2 for 'b' and so forth and then adds these values together. What would the hash value of "dog" be? ________________________ H.
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.

This note was uploaded on 11/30/2010 for the course CS 307 taught by Professor Scott during the Spring '08 term at University of Texas at Austin.

Page1 / 20

Fall01Final - 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