## Print Top View of Binary Tree

Given an binary tree, print top view of it. Assume, the left and right child of a node makes 45 degree angle with the parent.

Coding made easy

Given a binary tree, write an efficient algorithm to print left view of binary tree.

In the previous post, we have seen how to implement our own Multiset class in Java which allowed duplicate elements, unlike java.util.Set. In this post, we will quickly discuss common utility methods provided by Apache Commons’s Multiset interface.

Write an efficient algorithm to compute the height of binary tree. The height or depth of a tree is number of edges or nodes on longest path from root node to leaf node. The program should consider number of nodes in the longest path. For example, height of an empty tree is 0 and …

Write an efficient algorithm to check if two binary trees are identical or not. i.e. if they have identical structure & their contents are also same. The idea is to traverse both trees and compare value at their root node. If the value matches, we recursively check if left subtree of first tree …

In this post, we will see how to detect cycle in a a linked list using Hashing and Floyd’s Cycle Detection Algorithm.