development

Height of a Binary Tree: Recursion Unrolled & Explained

— tags: >- development, C++, tree, height, programming, recursion, internals, complete flow categories: development — Height of a Binary Tree is the longest path in the tree. Code int getHeight(node *root) { if (root == NULL) { return -1; } int leftHeight = getHeight(root->left); int rightHeight = getHeight(root->right); return (max(leftHeight, rightHeight) + 1); } Suppose […]

Read more