221 In-Lab Page
Fall 2005

Lecture Schedule

In-Lab 9--November 7, 2005
Recursion

Suppose you have an array of integers, and you want to find the largest one using recursion (yes, I know you can do it easily using iteration, but I want you to learn how to design and implement a recursive solution!)

The problem

Part 1: The Design

Part 2: The Implementation

Hand in:

The source code for the class max( ) and a run showing your solution works.


In-Lab 10--November 14, 2005
Linked List Review

Since we have an exam Wendesday, which will cover linked lists (among other things) and since it has been a while since you have worked with linked lists, today's lab is on linked lists.

The code missing from the LListReview class is from the nested class IteratorR.

In-Lab 12--November 28, 2005
Sorting and the Java Library

Today's lab asks you to sort a variety of lists. You can write your own sorting algorithm, or you can use the sorting algorithms in the Java library.   I advise using the library.

Note: The code below helps you over some of the syntax problems that do not specifically deal with sorting, but you will be expected to note the syntax and be able to use it in the future.

  1. To get warmed up: Hint: use the sorts in the Arrays class

  2. The real problem: Hint: use the sort in the Collections class

Note: For input above I used the BufferedReader class (since I did not have 5.0 on the machine I was using) instead of the Scanner class. You can change it if you wish.