title: Recursive Post-order Traversal Deallocating Binary Tree Nodes
body: <p>I am having trouble deallocating binary tree nodes using post-order traversal in recursive function.</p>
  
  <p>This is part of my struct.. My tree deconstructor will deallocate starting from the root</p>
  
  <pre><code>struct Node {
      Base * data;
      Node * left, * right, *parent;
      static long occupancy;
      long balance;
      long height;
  
      Node (Base * element) : data (element), left (0), right (0),
          parent (0), balance (0), height(0) {
  
           occupancy++;
      }
  
  
      ~Node (void) {
  
          deleteNodes();
  
      }
  
      void deleteNodes (void) {
  
          if(height == 0)
              return;
  
          if(left)
              left-&gt;deleteNodes();
          if(right)
              right-&gt;deleteNodes();
  
          if(left)
              delete left;
          if(right)
              delete right;
  
          delete data;
  
  
      }
  }
  </code></pre>