Comp 271-400 Week 3

Crown 103, 4:15-8:15



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

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

Linked List

Class in change from ArrayList to LinkedList.

List-related examples:

Table of Factors

This is the example on Bailey page 88. Let us construct a table of all the k<=n and a list of all the factors (prime or not) of k, and ask how much space is needed. This turns out to be n log n. The running time to construct the table varies with how clever the algorithm is, it can be O(n2) [check all i<k for divisibility], O(n3/2) [check all i<sqrt(k)], or O(n log n) [Sieve of Eratosthenes].

Finding a space character in a string

The running time depends on whether we're concerned with the worst case or the average case (we are almost never interested in the best case). If the average case, then the answer typically depends on the probability distribution of the data. If the text consists of English words separated by spaces, then in most cases we'll find a space in <=10 steps, as most English words are <= 10 characters long.


Hashing: lists.html#hashing

   in-class lab: GetHashCode() values of strings from's classes and

Chapter 6: Sorting

See sorting.html#sorting



Recursion starts at Bailey page 94
See recursion.html

Go through factorial in detail


Postage (currently first-class is 49¢, and post cards are 34¢)

in-class lab 2



binary trees
insertion and search
tree-based dictionaries