This preview shows pages 1–2. Sign up to view the full content.

CS100J About Prelim III: Tuesday, 7:30--9:00PM, 17 April, Olin 155 Review session: Sunday, 15 April, 1:00--3:00. Philips 101 For this prelim, you need to know everything that you needed to know for the first two prelims (see review below). In addition: For loops . We may give you a problem that requires you to write a loop (with initialization) that processes a range of integers. You should be able to write a post- condition, then write the loops header " for ( int k . ..)", then write a loop invariant, and finally develop the various parts of the loops and initialization. While loops . We may give you a precondition, post- condition, and a loop invariant, and you will have to develop the loop, with initialization, from it. The grade will depend on how well you deal with the four loopy questions and the given invariant. Please remember that the only variables that should be used (outside of variables declared in the repetend) are variables that are mentioned in the loop invariant. Arrays . Everything on Sects 8.1 and 8.2 of the class text —these pages discuss the technical details for us- ing arrays in Java and for reasoning about arrays. Two dimensional arrays: You should know how to declare and use rectangular arrays and ragged arrays; this re- quires knowing how arrays are stored. Sects. 9.1, 9.2, 9.3.1, 9.4. Algorithms . You should know the following algo- rithms. For example, if we ask "what is algorithm parti- tion", you should be able to write the precondition and postcondition (we won't give them to you), write down the invariant, and then develop the loop with initializa- tion. These algorithms are discussed in the text, on the ProgramLive CD, or in lectures notes: Algorithm Binary search (Sec. 8.5.3) Algorithm Find minimum (Sec. 8.5.1) Algorithm Partition (PLive activity 8-5.5 class notes may be better Algorithm Selection sort (Sec. 8.5.4) Algorithm Insertion sort (Sec. 8.5.5) On selection sort and insertion sort, we will not want to see the inner loops. The repetends of these algorithms should be written at a high level, stating what is done and not how it is done, as discussed in the text and in lecture. Since you know that at least one of these will be on the test, please practise developing all of them. Answering a question on one of these should take 5

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.