You are on page 1of 2

/*

* To change this license header, choose License Headers in Project Properties.


* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package practise;

/**
*
* @author Nitin Kumar
*/
public class Trees {

Node head;

static class Node


{
Node left;
int data;
Node right;
Node(int data)
{
this.left=null;
this.data=data;
this.right=null;
}
}

void preorder()
{

void insertNode(int data)


{
Node temp = head;
Node newNode = new Node(data);
if (head!=null) {
head = newNode;
}
else
{
while (head.left!=null) {

}
}
}

void displayTree()
{

public static void main(String[] args) {


Trees h = new Trees();
h.head = new Node(0);
Node second = new Node(1);
Node third = new Node(2);
h.head.left = second;
h.head.right = third;
}

You might also like