# Binary Trees

**TIP: ** To crack algorithms on binary search trees we need to be good at recursion, usage of queues and usage of stacks. Imagining the traversal of BST is important and then decide whether to use queue or stack based on the traversals.

spiral traversal of binary tree: This can be done using two stacks in iterative manner. The below diagram depicts the spiral traversal of BST …

algorithm to find left view and right view of binary tree in java: This algorithm is an extension of breadth first search. In BFS we just print level wise nodes whereas here while printing level wise …

find depth of binary search tree We can find the depth of binary tree in three different recursive ways; 1. using instance variables to record current depth and total depth at every level….

print level wise nodes in the binary tree This can be achieved using breadth first traversal algorithm. 1. push level wise nodes into the queue at every iteration. 2. pop the node from queue at every iteration and print its value

how to print leaf nodes in a binary search tree The logic here is simple. Recursively go through left and then right elements, when it goes beyond these two recursive calls, ..

types of traversals in a binary tree There are three types of traversals in binary tree: pre-order, in-order and post-order …

## Recent Comments