5 stories


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.

606 views Amin A.

Given a node in a binary tree, implement the algorithm for finding its next in-order node in the containing tree.

511 views Amin A.

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.

476 views Amin A.

Write an algorithm that takes a tree data structure and writes out all the elements in a breadth-first traversal order.

473 views Amin A.

How many binary tree topologies are possible given n nodes?

528 views Amin A.