Create a binary tree from inorder and preorder traversal given in array form (Fixes: #2707) (#2710)

Co-authored-by: Amit Kumar <akumar@indeed.com>
This commit is contained in:
Amit Kumar
2021-10-26 11:42:50 +05:30
committed by GitHub
parent ec127df959
commit b02a3fc818
2 changed files with 101 additions and 1 deletions

View File

@@ -22,7 +22,7 @@ public class BinaryTree {
*
* @author Unknown
*/
class Node {
static class Node {
/** Data for the node */
public int data;
/** The Node to the left of this one */
@@ -53,6 +53,11 @@ public class BinaryTree {
root = null;
}
/** Parameterized Constructor */
public BinaryTree(Node root) {
this.root = root;
}
/**
* Method to find a Node with a certain value
*