Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.39 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Complete:
  2. 1 = complete, 0 = not complete
  3.  
  4. int complete (node) {
  5.         if node->key == 0
  6.                 return 1
  7.         else
  8.                 get left node height
  9.                 get right node height
  10.         if left & right = 0
  11.                 return 1
  12.         else if left == right
  13.                 if left tree != full
  14.                         return 0
  15.                 else
  16.                         return complete(right)
  17.         else if left == right + 1
  18.                 if right tree != full
  19.                         return 0       
  20.                 else
  21.                         return complete(left)
  22. else
  23.         return 0