{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HW1 4 - track of whether or not the client wants you to...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
\ We are suggesting that you develop the program in three stages: 1. For this version, we won't worry about the issue of unique values. We just want a basic version of the class that keeps a list in sorted order andthat uses binary search to speed up searching. This stage involves all of the following (not necessarily in this order): a. Copy Anaylntlistjava to Sortedlntlistjava and change all occurrences of Arraylntlist to Sortedlntlist. That way you'll have a new class that has the same behavior asthe old Arraylntlist class (including the two constructors). b. Make sure that the two-argument addmethod to addat an index is no longer a public method. c. Modify the one-argument addmethod so that it preserves sorted order. You may need to use binary search here aswell if your solution involves fwo steps (first locate, then insert). d. Modiff indexOf so that it uses the binary search method. 2. Modify your code so that it keeps
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: track of whether or not the client wants you to guarantee that the list has unique values. Add the two constructors that involve setting unique and modiff add so that it doesn't add duplicates if unique is set to true. 3. Modiff your code to have getUnique and setUnique. Remember that if the client calls setUnique and sets the value to true, you have to eliminate any duplicates that might be in the list. We will be providing testing code for each of these three stages, and for only this program you are allowed to discuss how to write testing code with other students. Keep in mind that these tests are not guaranteed to be exhaustive. They are meant to be examples of the kinds of tests you should perform. In particular, you will want to do a lot of simpler testing before you try rururing any of these high-powered tests that really push the limits. Page 4 of 4...
View Full Document

{[ snackBarMessage ]}