ECE218 R Data Structures Spring 2025
Tue & Thur, 2:00 to 3:15, in MCA 202 A

Useful information and things

Examinations:

Assignments:

Read the Important Rules link above.
All to be submitted on blackboard (under Assignments)
Submissions should be clearly readable word documents.

    1   Due: Sat. 8th February .
       Reverse Polish Calculator.
2Due: Thur. 27th February.
Creating and programming your own virtual machine.
3Due: Sat. 29th March.
Super-integer calculator.
4Due: Thur. 24th April.
Another super-integer calculator.
4Due: Tue. 29th April.
A collection in a binary tree.

Class History

Class 1 - Tue 14-1-2025    Quick introductions.
What pointers are all about.
Class 2 - Thur 16-1-2025 Remembering (or maybe finding out) what structs are for, twelve steps:
one, two, three, four, five, six, seven, eight, nine, ...
Class 3 - Tue 21-1-2025 Still to look at: ten, eleven, twelve.
and a lucky thirteenth one for what we are about to do.
Class 4 - Thur 23-1-2025 a closer look at take_int from example 13.
Vectors.
Reverse Polish Notation.
Here are the jottings from today's class including the demonstration of arrays being dangerous.
How to convert a string that looks like a number into that number.
Class 5 - Tue 28-1-2025 Details for the first assignment.
fast to-the-power-of operations,
the bitwise binary operators & | ^ << >>
new and delete give the effect of changing an array's size and lifetime
.
protected: and public: in struct definitions.
Class 6 - Thur 30-1-2025 Useful technique: find the closest fraction to a double.
A surprisingly complex task: how to convert a string that looks like a number into that number.
Protected: (and private:) only protect programmers who behave nicely:
       Trivialised version of fractions program showing normal behaviour,
       Protected: protecting us from bad behaviour,
       An experiment, just to make what comes next easier,
       Typecasting pointers to evade protection.
Class 7 - Tue 4-2-2025 Various things concerned with making our own vector,
Must work effectively in two different ways: as a safe growable array, and as a stack, operator[]
Reference results, like reference parameters, are useful.
Class 8 - Thur 6-2-2025 operator+=, operator=, copy constructor, destructor for vectors.
Class 9 - Tue 11-2-2025 A new adventure: creating and programming our own virtual machine.
Class 10 - Thur 13-2-2025 Little add-on from Tuesday: how functions, local variables, and even recursion can be handled.
Amortised time analysis: why vectors should grow by doubling their size.
Class 11 - Tue 18-2-2025 Two (and more) dimensional arrays.
Many troubling C++ "features", including multi-dimensional arrays, and how to fix them.
How to use <cstdarg>.
Class 12 - Thur 20-2-2025 Efficient implementation of multidimensional arrays with variably based indexes.
Simple use of templates for class definitions.
Constructors and destructors for tracing.
An attempted database.
Class 13 - Tue 25-2-2025 Pointers to the rescue: the attempted database works.
Big (and complicated) example of all sorts of things with classes.
using istringstreams.
Selection sort and its efficiency (or lack of it).
Class 14 - Thur 27-2-2025 What the "big O" notation is really all about.
Insertion sort and bubble sort.
Loop invariants and variants help to understand, explain, and validate.
Class 15 - Tue 4-3-2025 A miscellany of test review items.
Class 16 - Thur 6-3-2025 First mid-term test.
       Vectors and multi-dimensional arrays: the C++ way making your own.
       Classes, methods, con/de-structors, operators, static things...
       Quadratic sorting algorithms.
And of course general C++ and programming will be required.
A sample test (not question 1), and its solution,
Another sample (only question 3), and its solution.
Another sample (only question 6),
Yet another sample (only question 5), and its solution.
Break 10th to 14th
Class 17 - Tue 18-3-2025 About the next assignment, a super-int calculator.
Creating single objects with new; exactly why making a pointer to an existing object is dangerous.
At the supermarket.
Representation of giant ints and how to add, subtract, and multiply.
Why it is dangerous to create an object with & instead of new.
Fragmentation of memory.
Our first linked list, just 3 operations so far: create, print, reverse.
(See class 18's notes link for today's notes, they are combined)
Class 18 - Thur 20-3-2025 Much more with linked lists: searching, adding up all the values, linked list as dictionary.
Reduce and map (called apply_to_all here), functions prototypes, functions being parameters.
A templated linked list of anything with a very general templated search method.
Today's notes.
Class 19 - Tue 25-3-2025 More with linked lists: adding to the end (2 ways), length (2 ways), etc...
Today's partial notes.
Class 20 - Thur 27-3-2025 Recording the end of the list doesn't help with removing from the end.
Doubly linked lists would do that.
Selection sort on a linked list is almost identical to the array version.
Today's partial notes.
Class 21 - Tue 1-4-2025 Insertion sort and bubble sort on linked lists.
Class 22 - Thur 3-4-2025 Insertion sort on a linked list, it has a useful dual purpose.
Splitting a linked list in half, and combining two sorted linked lists.
Class 23 - Tue 8-4-2025 How merge-sort on linked lists really works - no sorting (sort of).
Vital thing to get: demonstrating that merge-sort's time is O(N*log(N)) and why that matters.
Class 24 - Thur 10-4-2025 A quick look at a doubly-linked list.
Binary trees.
Class 25 - Tue 15-4-2025 (for the division by two thing set out nicely see the assignment)
Lots more with binary trees.
Class 26 - Thur 17-4-2025 Even more about binary trees.
Class 27 - Tue 22-4-2025 Second test: Linked lists, fast sorting, and binary trees.
Sample 1: Questions 5 and 7 only.
Sample 2: Questions 6 and 7 only.
Sample 3: Questions 5 and 7 only.
Don't treat the samples as all-inclusive. Anything we have covered on those topics could appear.
Class 28 - Thur 24-4-2025 Review Q1 from MT1.
Quicksort.