Category Archives: Trees

Flip Binary Tree

Given a binary tree, the task is to flip the binary tree towards right direction that is clockwise. See below examples to see the transformation. In the flip operation, left most node becomes the root of flipped tree and its parent become its right child and the right sibling become its left child and same… Read More »

Find a number in minimum steps

Given an infinite number line from -INFINITY to +INFINITY and we are on zero. We can move n steps either side at each n’th time. 1st time; we can move only 1 step to both ways, means -1 1; 2nd time we can move 2 steps from -1 and 1; -1 : -3 (-1-2) 1(-1+2)… Read More »

Evaluation of Expression Tree

Given a simple expression tree, consisting of basic binary operators i.e., + , – ,* and / and some integers, evaluate the expression tree. Examples: Input : Root node of the below tree Output : 100 Input : Root node of the below tree Output : 110 As all the operators in the tree are… Read More »