Tree/count_full_nodes library

🌳 Count Full Nodes in a Binary Tree

Counts the number of full nodes (nodes with both left and right children) in a binary tree.

Time complexity: O(n) Space complexity: O(h)

Example:

final root = BinaryTreeNode<int>(10);
root.left = BinaryTreeNode<int>(5);
root.right = BinaryTreeNode<int>(15);
final count = countFullNodes(root);
// count: 1

Functions

countFullNodes<T>(BinaryTreeNode<T>? root) → int