Comp 271-400 Week 6

Cuneo 311, 4:15-8:15

Readings:

    Bailey chapter 5 section 2 on recursion
    Bailey chapter 6, on sorting.
    Bailey chapter 9 section 4 on Singly Linked Lists
    Bailey chapter 15, section 4, on Hash Tables.

    Bailey chapter 3, on a Vector class

    Morin 3.1: Singly Linked Lists
    Morin 5.1: Chained Hash Table
    Morin Chapter 11: sorting (Merge-sort and Quicksort only)

Primary text: Bailey, online, and maybe Morin, also online.



Objects
    Polymorphism

Zuul

classes: Game, Room, special rooms, RoomMaker



Compiler intro

in-class lab 1

Install the lab 6 compiler and run a simple program.

Lab 6 discussion





Traversers

Notice that class StrTree implements an interface:

    class StrTree implements Iterable<String>

What does this mean? It means there must be an iterator() method, as follows:

public Iterator<String> iterator()  { return new StrTreeIterator();  }

How does this work?

More important is what it enables, which is, with tree a StrTree:

        for (String s : tree) System.out.println(s);

Iterator discussion: arraylist, hashtable, StrTree




Tree balancing

    Tree rotations
    AVL trees