title: Freeing memory Binary trees
body: <p>I have a function that creates a binary tree(*build_tree)* (Huffman).</p>
  
  <p>I also need a function that free's the memory that <em>build tree</em> allocated.</p>
  
  <p>It's my first time working with binary trees so I'm kind of confused.
  Should I create a loop that goes through each node in the tree and deletes it?
  Should I consider if the node is a leaf or a parent node?</p>
  
  <pre><code>void free_memory(NodePtr root)
  {
      delete root;
  }
  
  struct HuffmanNode
  {
     //some stuff
      HuffmanNode *left;
      HuffmanNode *right;
  };
  </code></pre>
  
  <p>Would appreciate it if someone could help me get started :)</p>