Exercise Set 3: Collections and Algorithms

Exercise 3.1 The goal of this exercise is to set up a foundation for exploring and analyzing various algorithms and the data structures they manipulate. The data set used by the algorithms is created either from user input, or from existing data structure - such as a cons-list or an array.

  1. Draw a UML diagram of al classes we defined to implement IRange. Identify the connection with the user input/output, or a connection to a file via link to an oval with the label describing the nature of interaction.

  2. Draw a UML diagram of Collection interface, the AbstractCollection class, and three derived classes: ArrayList, LinkedList, and the class ArrayCollection, which you started on in the lab.

  3. Complete the design and implementation of the class ArrayCollection. Do not forget to test it.

  4. Design the class Algorithms as follows:

  5. There are three kinds of methods in this class: accessors, queries, and filters. Accessors allow the access to the dataset through its iterator, and by returning objects in the dataset. Queries answer questions about the dataset, leaving its structure intact. Filters modify/mutate the structure - sorting it, extracting a dataset that satisfies some predicate, or by mutating the contents according to a given function.
    Design the following queries:

  6. You will need the following tests. Develop each test suite as part of the design recipe. Group different test suites together and run them one at a time as follows: