title: How to check if a binary tree is complete in Java
body: <p>I am having a lot of trouble with this task. Using the Wikipedia definition for a complete binary tree:</p>
  <blockquote>
  <p>A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible</p>
  </blockquote>
  <p>I need a way of checking for these conditions, but no matter how much I try, I can't seem to come up with anything. If I were to pass a <code>TreeNode tree</code> input into a <code>checkComplete</code> method how could I go about going through the binary tree and checking that it is complete? Can anyone help with pseudocode or an explanation of how this is possible? There was another question here: <a href="https://stackoverflow.com/questions/1442674/how-to-determine-whether-a-binary-tree-is-complete">How to determine whether a binary tree is complete?</a></p>
  <p>This one had an answer with pseudocode in it, but I couldn't understand where all the random variables were coming from or what they were meant to represent or why there were two values in brackets in the last 3 lines. If anyone could help with another representation I'd really appreciate it.</p>