Given a tree, prune it to select for only a certain node color
Given that a tree is made of only red or black nodes, return another tree that only has the paths of the original tree leading to a red node.
Problem Statement
Given that a tree is made of only red or black nodes, return another tree that only has the paths of the original tree leading to a red node.
References
Ankur from Google
Recommended reading
-
Breadth First Tree Traversal
Write an algorithm that takes a tree data structure and writes out all the elements in a breadth-first traversal order.
-
Closest Common Ancestor of a Node in a Tree
You have a tree data structure. Write an algorithm that given any two nodes in the tree, finds the node that is the closest common ancestor to them.
-
Google search results for the top 1000 highest ranking URLs
You have trillions of URLs stored uniquely, without order, across numerous machines, each with a score. Find the 1000 URLs with the highest scores.
-
Extreme Recursion with Binary Tree Topologies
How many binary tree topologies are possible given n nodes?
- Author
- Amin Ariana
- Published
- April 2011