Skip to content

Instantly share code, notes, and snippets.

@PsySc0rpi0n
Last active May 30, 2016 21:49
Show Gist options
  • Save PsySc0rpi0n/344f3c11a339bda685af84d895dfdc22 to your computer and use it in GitHub Desktop.
Save PsySc0rpi0n/344f3c11a339bda685af84d895dfdc22 to your computer and use it in GitHub Desktop.
recursive functions
int GetNodeHeight ( bstNode *node ) {
int height_left = 0;
int height_right = 0;
if( node->left ) height_left = GetNodeHeight ( node->left );
if( node->right ) height_right = GetNodeHeight ( node->right );
return height_right > height_left ? ++height_right : ++height_left;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment