Write a program to create a binary Tree ?

Answer Posted / marshal

public class BinaryTree
extends AbstractTree
{
protected Object key;
protected BinaryTree left;
protected BinaryTree right;

public BinaryTree (
Object key, BinaryTree left, BinaryTree right)
{
this.key = key;
this.left = left;
this.right = right;
}

public BinaryTree ()
{ this (null, null, null); }

public BinaryTree (Object key)
{ this (key, new BinaryTree (), new BinaryTree()); }
// ...
}

Is This Answer Correct ?    7 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of literals?

571


What is null object in java?

577


How do you start a thread?

556


Can we create our own wrapper class in java?

553


Can memory leak in java?

591






Where are global variables stored?

513


Which keyword specify that a variable is effectively final ?

584


What are constructors in java?

576


What are voids?

545


What is the purpose of the finalize() method?

717


What is a nullable field?

583


Can we define constructor in inner class?

547


What is the function of java?

519


What is the advantage of functional interface in java 8?

531


What is application tier?

534