- Dynamic memory allocation: when having an upper bound on the allocated
memory is not good (e.g. for stacks and queues).
When space is allocated and deallocated in an
unpredictable fashion (as opposed to stacks and queues).
- Linked lists: motivation, definition, operations: insert, delete, empty.
- Informally drawing lists. Box representation.
- Implementing a node of a list in C/C++: struct, typedef and pointers; arrow
- Allocating a new node in C/C++: the new operator.
- Discussion of subtleties in implementing list operations. The
head of a list.
- Implementation of the operations on lists: insert,
delete, empty, etc. Implementation of the Linked List ADT.
Look at the first part of
- Allocating space dynamically. The new and
delete operators in C++.
Look at the second part of example.cpp and execute it
(typescript), see how new and delete
work. Careful with their use.
- The Linked List abstract data type.
- Hwk: C++ class for lists.
Next week: applications of lists, and: pointers, pointers, pointers...
For practicind the
ideas discussed in class today, look at an old
exam. Do problems 3, 5 and 6 from the
exam. Be ready
to ask me questions on Tuessday.
More QT exercises.
- Look at this improved Stack QT application. It uses a real stack (of characters), and uses the
QT interface just to display its contents and control the operations.
- Copy the files in a local directory.
- Make a QT project, compile and execute the application.
- Modify it (or design one from scratch) to work with your new Queue data structure (on characters).
- Do not submit anything, but be ready to show me in class, on Tuesday, how far you went on this project.
- More QT, independent work following small tutorial examples.
- Go to QT Tutorial 1.
- Do dilligently the first 4 chapters in the tutorial. Together with the QT Queue exercise, these will also
be part of your next homework.
- There is nothing to submit, but you should be
prepared to show to me in class, on Tuesday, the result of your work.