<!DOCTYPE html>
<html data-require="codemirror blockUI math math-format word-problems spin">
  <head>
    <title>Binary Tree Height Exercise</title>
    <script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.14/require.min.js"></script>
    <script src="../../khan-exercises/local-only/main.js" ></script>
    <style>
      #BTdepthPROG .CodeMirror {
        height: 200px;
      }
    </style>
  </head>

  <body data-height="750" data-width="950">
    <div class="exercise">
      <div class="vars">
        <var id="config">
          (function(){ window.OpenPopKa = true;}())
        </var>
      </div>
      <div class="problems">
        <div id="BTdepthPROGp"> <!-- Supresses answer box -->
          <p class="problem"> The height of a binary tree is
            the length of the path to the deepest node. An empty tree has a
            height of 0, a tree with one node has a height of 1, and so
            on. Write a recursive function to find the height of the
            binary tree pointed at by "root".<br/>

            <textarea id="codeTextarea" name="codeTextarea">
int BTdepth(BinNode root) {
// Your code goes between these lines


// Your code goes between these lines
}</textarea>
          </p>
          <div class="question"></div>
          <div class="solution" data-type="custom">
            <div class="guess"> [ editor.getValue()  ] </div>
            <div class="validator-function">
              if (guess[0] != initEditor) {
                console.log(guess[0]);
                window.codeValue = guess[0];
                window.progexType= "BTRecurTutor";
                window.summexName= "BTdepthPROG";
              } else {
                return "";
              }
            </div>
          </div>
          <div class="hints">
            <p>If the tree is null, return 0.</p>
            <p>Otherwise, simply return 1 + the larger of the heights
              of the children.</p>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>
