Next: Textbook
Up: Advanced C++ Programming
Previous: Lecture notes
Code
- Passing matrices to functions: we can pass a matrix
as is
(then we must provide all but
the first dimensions--not general) or as a
linear array
(general solution, but
pointer arithmetic must be done by hand). The most elegant (and
indeed most general) solution would be to have matrices of
non-contigous columns, but this might imply some extra processing;
this solution is outlined here.
- This archive
contains our
first implementation of linked lists (
list.h and
list.cc) and code for a simple test program (main.cc).
It contains a suitable makefile as well.
- This archive
contains an
implementation of search trees. The implementation has been
requested as an assignment for the Fall 2003 incarnation of this
course, and the archive contains the handout for the respective
assignment (called
handout.pdf) as well as my solution
(everything else).
- Here is a more or less complete
implementation of lists of integers. The
implementation contains some techniques (exceptions) about which we
shall talk later in the course. This implementation also overloads
the subscript opoerator (
operator[]) as discussed in class
(i.e., as accessor as well as mutator). Note that the mutator is
called every time in non-const lists. The accessor
is used only on const objects. There is no way of selecting
the accessor according to whether we need an lvalue or not without
doing some explicit casting.
- This archive
contains an
implementation of search trees as a C++ data type (or class). The
implementation has been requested as an assignment for the Fall 2003
incarnation of this course, and the archive contains the handout for
the respective assignment (called
handout.pdf) as well as the
official solution (everything else).
- An implementation of templated lists (including a random
iterator over lists) is
here.
Next: Textbook
Up: Advanced C++ Programming
Previous: Lecture notes
Stefan Bruda
2010-04-29