Computer Algorithms II Class Notes

Computer Algorithms II Lecture Notes

13 September 2007 • Dynamic Storage Management


The code shown won't work for standards-compliant C++ compilers because the array-bounds isn't considered constant, despite what the code says. The easiest way around this problem is to replace the const declaration with a preprocessor macro:

#define node_count 10000

typedef <typename T>
class binary_tree {

  private:

    node nodes[node_count];
  };

This is a terrible work-around, but because we'll soon be discussing a better way around the problem, it'll stand for now.


This page last modified on 24 January 2006.