# Tagged: cracking the coding interview

Note: We can do in-order traversal, which will give us a sorted array and then find the in-order successor very easily. But the time complexity of in-order traversal in O(n). Where as finding the...

Binary tree and Binary search tree are defined as follows : Binary tree is a tree data structure in which each node has at most two child nodes. A binary search tree (BST) is...

Problem description : Convert a given binary tree to a linked list of all the nodes at each depth (if you have a binary tree with depth D, you’ll have D linked lists). Logic...

Problem description : Given a sorted (increasing order) array with unique integer elements, create a binary search tree (BST) with minimal height. Input : A sorted array with unique integer elements // [0, 1,...

A balanced tree is defined to be a tree such that the heights of the two subtrees of any node never differ more than one. Input : The root of a binary tree Output...