CS 112
Lecture 9
- Class discussion: why the templated Insertion Sort we did in
class last week won't work with Hw4. Problem: we want to sort an
array of struct-ures, by some field. The comparison needs a
different syntactic notation.
- A solution: passing a Comparison function as a parameter to
the Sorting function.
- A complete
Selection Sort with templates and functions as parameters.
- Lab: Insertion Sort with templates and functions as
parameters:
time, about 1 hour.
- To think of what functions can still be templated, in the
previous code.
- Some questions about the hwk: no delete from the swimming
pool (swimemrs do not leave the pool!!!). Format of input for the
program: one line per swimmer, with name sex type age level
separated by spaces. End of input (when all swimmers have been
entered) marked with a sharp sign #.
Ileana Streinu