Combinatorics › Counting principles › Bits and binary trees

Count unival subtrees in a tree

High school · ●●○○○ 20 pts

A unival subtree of a binary tree is a subtree in which all nodes have the same value. A single leaf counts as a unival subtree. Consider the following binary tree. The root has value 00. The root's left child has value 11 and is a leaf. The root's right child has value 00; its left child has value 11 and its right child has value 00 (a leaf). The node with value 11 (the left child of the right child) has two children, both with value 11 (leaves). How many unival subtrees does the tree have?

Sign in to save your progress.

binary treesrecurrence relations