Root out the roots

Given a perfect binary tree of depth 10 10 , how many nodes exist such that the tree could be rerooted there such that the resulting tree is still a binary tree (but not necessarily perfect)?

Clarification:

  • You know all nodes and their corresponding values and their connections; but you don't know which node is root, parent or child or leaf if any. Depth of a tree with only one node is 0 0 .
  • A fully-connected binary tree is that whose nodes have either two or no children.
  • A perfect binary tree is a fully connected binary tree in which all leaves are at the same level.

The problem is a part of this set


The answer is 1025.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

0 solutions

No explanations have been posted yet. Check back later!

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...