Thursday Practice Sessions

Last Thursday
Practiced writing regular expressions and grammars.

Thursday #7
Talked about the last assignment -- inheritance, etc.

Thursday #6
Since it was right after the exam, there were no specific problems solved. Questions on factories, etc. were answered.

Thursday #5
Balancing AVL trees (figuring out where they are out of balance, figuring out what kind of rotation to do, and then balancing them)

Thursday #4
Built heaps using both techniques, inserting one at a time and all at once (the linear algorithm for building a heap). We also practiced removing (deleteMins).

Thursday #3
Solved a Dijkstra Shortest Path algorithm.
Graph and solution provided by John Comstock.

Thursday #2
Finished isSimilar tree function from first Thursday.
Solved another tree problem:
Given a level (root is level one), return the number of nodes at that level.

A sample main could be:
  BinTree tree;
  // build the tree
  int result = tree.getLevelCount(3);

Thursday #1
I lectured to some people reviewing memory management, for example:
  • What memory looks like with objects and object containing pointers
  • What happens when dynamically allocating memory for object
  • What happens inside an activation record when using dynamic memory
  • What happens if you don't write a copy constructor when using dynamic memory

    During this, others were working on the following tree problem:
    Two binary trees are considered similar if they are either both empty, or if they are both nonempty, then their left subtrees are similar and their right subtrees are similar. In other words, they have exactly the same structure.

    A sample main could be:
      BinTree tree1, tree2;
      // build the trees
      bool result = tree1.isSimilar(tree2);

    Students did not successfully write this function, so we'll work on it again the following week.