CSC 344
Homework 4
Assigned 30 March, due 20 April
Problems from the textbook
There are a lot of them, but most of them are either short or
straightforward (e.g. apply an algorithm given in the book to a specific
input). There is one programming assignment.
- 6.1.6 (see p. 126 for the number of comparisons made by
merge-sort): when do you save work by pre-sorting?
- 6.1.9: are there two numbers in the list that add up to a
given number?
- 6.1.10: find all sets of anagrams in a list of words (program)
- 6.2.7: doing Gaussian elimination by hand on your own examples
- 6.3.4: build AVL tree for given examples
- 6.3.7: build 2-3 tree for a specific example, and analyze it
- 6.4.1: build heap for a specific example
- 6.5.6 and 6.5.7: example of fast exponentiation.
Use power 19 instead of 17, so it's easier to see the difference between
left-to-right and right-to-left algorithms.
Note: I originally dropped this problem because people had
already done fast exponentiation on homework 3 (problem 4.1.3)... but
almost all of you completely missed the point and wrote linear-time
algorithms! So let's try again with these problems.
- 6.5.10: representation of polynomials
- 6.6.7: reducing a problem to 0-1 linear programming.
- 6.6.9: reducing edge-coloring to vertex-coloring
- XC: 6.6.10: jealous husbands
- XC: 7.1.7: checking ancestry in a tree. Note: The
best solution I've come up with assumes that
the number of nodes can be stored in a single
machine word (on which you can do constant-time arithmetic operations).
If you drop that assumption, I don't think it's possible.
- 7.2.1, 7.2.2, 7.2.3: Horspool string matching
- 7.3.1, 7.3.2: examples of open and closed hashing
- 7.4.6: build 2-3-4 tree for given example
Last modified:
Tue Mar 30 09:51:52 EST 2004
Stephen Bloch / sbloch@adelphi.edu