Given a Binary Tree and a positive integer k, print all nodes that are distance k from a leaf node.
Here the meaning of distance k from a leaf means k levels higher than a
Interview Questions asked in Google, Microsoft, Amazon
by Dhaval Dave
Given a Binary Tree and a positive integer k, print all nodes that are distance k from a leaf node.
Here the meaning of distance k from a leaf means k levels higher than a
by Dhaval Dave
by Dhaval Dave
by Dhaval Dave
Input: In-order traversal in[] = {4, 2, 5, 1, 3, 6} Pre-order traversal pre[] = {1, 2, 4, 5, 3,
by Dhaval Dave
Implementation of Binary Tree in Java Language.
import java.io.*; import java.util.*; class Node { public int iData; // data item (key) public double dData; // data item public Node leftChild; // this node's left child
by Dhaval Dave
In graph theory, breadth-first search (BFS) is a strategy for searching in a graph when search is limited to essentially two operations: (a) visit and inspect a node of a graph; (b) gain access to
by Dhaval Dave
Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some arbitrary node as the root in the case of a graph) and explores