This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CIS 121 - Spring 2010 First Midterm Review – given out Friday, February 19 Our first midterm is scheduled for Wednesday, February 24, during the normal lecture period. Please come to the usual classroom, we shall try to fit everybody there. Please arrive a few minutes before 11AM to give us time for seating arrangements. We will have a review session on Monday February 22, during the normal lecture period. This review sheet contains a list of readings, some sums to memorize, a mock exam, and some additional review problems. These questions should give you an idea of the scope and style of the questions that you’ll see on the exam. Note that all the material in the lecture notes, in the homeworks, or in the labs may potentially appear on the exam, even if it is not reviewed in the problems included here. The textbook is useful, and you should read the sections that have been recommended. We will post and distribute on Monday, February 22, solutions to these review problems. We strongly suggest that you attempt to solve them on your own before you see the solutions. 1 Readings Lecture notes 1–7 and from lecture notes 8 slides 1-26. Solutions to homeworks 1-4. Lab notes up to and including February 15-16. Recommended readings from textbook: Chapters 5, 7, 15, 16, 17, 18 and Sections 3.7, 4.8, 6.2-6.6, 6.8, 6.9, 19.1, 19.3, 21.1, 21.2, 21.5 2 Memorize! 1 + q + q 2 ...q n- 1 = q n- 1 q- 1 ( q 6 = 1) 1 + 2 + ... + n = n ( n + 1) 2 1 2 + 2 2 + ... + n 2 = n ( n + 1)(2 n + 1) 6 3 Mock Exam (50 minutes for 100 points) 1. (30 pts) For each statement below, decide whether it is true or false. In each case attach a very brief explanation of your answer. 1 (a) Suppose that the worst-case running time of method qq is Θ( n log n ) and the worst case running time of method uu is Θ( n 2 ). Then there is no input for which uu runs faster than qq , true or false? (b) There is no complete binary tree with 17 nodes, true or false? (c) It is possible to reverse the content of a stack using at most three other auxilliary stacks, true or false? (d) A priority queue is a queue in which elements are enqueued in order of their priority, true or false? (e) Suppose we decide to change our model of computation (step-counting) by counting instructions that involve the creation of an array new int[n] as taking 10 n steps. In this new model, a program can have a different asymptotic complexity than in the original model, true or false? (f) Suppose that f ( n ) is a function defined only for integers n ≥ 1 and that f ( n ) is O (1). Then, there exists a constant c such that f ( n ) ≤ c for all n ≥ 1, true or false? 2. (15 points) Prove that n 2 +3 n √ n is O ( n √ n ). You cannot use any of the theorems stated in the lecture notes, the textbook, or the lab notes. Your proof should rely only on the definition of Big-Oh....
View Full Document
This note was uploaded on 02/19/2010 for the course CIS 121 taught by Professor Tannen during the Spring '09 term at UPenn.
- Spring '09
- Data Structures