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

Where pragma is used?

592


What is overriding in java?

513


When to use runnable interface vs thread class in java?

514


What is difference between == and === in js?

539


What is skeleton and stub? What is the purpose of those?

535






What are the legal parameters?

499


What is passing by reference in java?

533


Name the components that are termed to be Heavy-weight component but available in Light-weight components?

1980


Explain the difference between an Interface and an Abstract class?

617


What are basic data types?

554


What is data movement?

658


How do you trim a space in java?

496


What is a line break example?

571


What is the difference between static method and instance method in Java?

560


What is the effect of keeping a constructor private?

469