fa10ex2 - University of Illinois at Urbana-Champaign...

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

View Full Document Right Arrow Icon
University of Illinois at Urbana-Champaign Department of Computer Science Second Examination CS 225 Data Structures and Software Principles Fall 2010 7p-9p, Tuesday, November 2 Name: NetID: Lab Section (Day/Time): This is a closed book and closed notes exam. No electronic aids are allowed, either. You should have 5 problems total on 15 pages. The last sheet is scratch paper; you may detach it while taking the exam, but must turn it in with the exam when you leave. Use scantron forms for Problems 1 and 2. Unless otherwise stated in a problem, assume the best possible design of a particular imple- mentation is being used. Unless the problem specifically says otherwise, (1) assume the code compiles, and thus any compiler error is an exam typo (though hopefully there are not any typos), and (2) assume you are NOT allowed to write any helper methods to help solve the problem, nor are you allowed to use additional arrays, lists, or other collection data structures unless we have said you can. We will be grading your code by first reading your comments to see if your plan is good, and then reading the code to make sure it does exactly what the comments promise. In general, complete and accurate comments will be worth approximately 30% of the points on any coding problem. Please put your name at the top of each page. Problem Points Score Grader 1 20 scantron 2 25 scantron 3 30 4 15 5 10 Total 100
Background image of page 1

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

View Full DocumentRight Arrow Icon
1. [Miscellaneous – 20 points]. MC1 (2.5pts) Which of the following is not a reasonable choice for implementing the Dictionary Abstract Data Type? (a) AVL Tree (b) B-Tree (c) Binary Search Tree (d) Stack (e) All of these are reasonable choices for implementing a Dictionary. MC2 (2.5pts) Suppose we do a level order traversal of the following binary tree. What is the maximum number of non-null nodes on the queue at one time in the execution of the algorithm? (a) 4 (b) 5 (c) 6 (d) 12 (e) None of these is the correct number.
Background image of page 2
Suppose we implement a stack using a dynamically allocated array. If the array fills, we are faced with a dilemma. From among the following choices, select the one that best describes our strategy for handling a filled array. (a) We declare a new array, twice as big as the original, and copy the data into the new space for a total cost of O ( n ), over a sequence of n pushes. (b) We declare another array and keep track of which of the two (or more) arrays contain the current top of the stack in a private member of the stack class. This costs us O (1) per push. (c) For some fixed k , we create a new array of size n + 2 k and copy the data into the new space for an average cost of O (1) per push operation. (d) We avoid implementing a stack using a dynamically allocated array, because it is ineffi- cient to have to reallocate memory. (e) None of these answers is a reasonable response.
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

fa10ex2 - University of Illinois at Urbana-Champaign...

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