# Binary Tree Project

The null links in a binary tree can be used to facilitate non-recursive traversal of the tree. For example, if we set each null right link ( except for the right link of the rightmost node) to point to its successor under inorder traversal, we have a right threaded binary tree. We can now do a non recursive inorder traversal of the tree in the following way:

Start from the root and go to the leftmost node by tracing the left links. Visit the node and go to its successor via its right link. If the right link is a thread link, it gives the successor; otherwise, move as far left as possible to locate the successor. Terminatewhen a null right link is reached.

This project is to modify the BinaryTree class to accommodate right-threaded binary trees. You need to add a flag variable to each node to indicate if a right link is a thread, write a method to turn an ordinary binaray tree into a right-threaded binary tree and write another mothod to demonstrate non-recursive inorder traversal.

Note that in a right-threaded binary tree, a node that has no right child and is itself the root of a left subtree should have its right link point to its parent. On the other hand, a node that has no right child and is itself the root of a right subtree should have its right link point to the parent of its highest ancestor. The parent of the root is set to null.

You will be given a test data file that contains several sequences of numbers. The numbers in each sequence are on the same line and separated by a space. You program should reach each sequence, build an ordinary binary search tree using simple insertion, right-threaded the tree and show each thread (i.e. if there is a thread from node 17 to node 41, then produce an output saying something like 17 -&gt; 41), and print the numbers using non-recursive inorder traversal. Specifically, the main method must look like:

BinaryTree T;

While( not end of input ) {

Build an ordinary binary search tree T;

print numbers in T via non-recursive inorder traversal;

}

The method for right-threading takes a pointer to a non-empty node N and a pointer to its parent P (or the parent of its highest ancestor as defined above). It starts with N being the root node of an ordinary binary search tree and P being null. If the current node has left child, use this left node and the current node to make a recursive call. If the current node has a right child, use this right node and P to make a recursive call. Otherwise, set its right pointer to P.

Taidot: Java

( 0 reviews ) New York, United States

Projektin tunnus: #477955

## Myönnetty käyttäjälle:

nerdsubhankar9

Greetings datas1101 please check pm. Thanks and regards.

30 \$ USD 3 päivässä
(0 arvostelua)
1.0

## 15 freelanceria on tarjonnut keskimäärin 71 \$ tähän työhön

tomky

Hi there. I have math skills and I am experienced in java. I can start right now. Thanks.

40 \$ USD 4 päivässä
(51 arvostelua)
5.3
doaaashour

I can easily do this in 2 days including all the testing. Check my profile.

30 \$ USD 2 päivässä
(2 arvostelua)
4.6
whiteChess

please check my PMB...thanks

50 \$ USD 0 päivässä
(1 arvostelu)
1.2
thilagab

Hi, I read the project description.The program is about Tree traversal and I have solid understanding of Data Structures and Algorithms. So please provide me a chance to prove my knowledge. Thank you. Regards, Th Lisää

75 \$ USD 5 päivässä
(0 arvostelua)
0.0

Hello, I can build it for you. But need some definitions later. I have 3 years experience in Java. Regards, Vlad Alex.

200 \$ USD 14 päivässä
(0 arvostelua)
0.0
roge

why do you need that crap ?

100 \$ USD 1 päivässä
(0 arvostelua)
0.0
coskung

Check your pmb pls.

90 \$ USD 2 päivässä
(0 arvostelua)
0.0
Infyramesh

I am working as a senior system engineer in Infosys with work experience of 2.1 yrs. I am working on Java technology since jun 11,2007 till date. I will complete the work with quality and i will strictly adhere to the Lisää

100 \$ USD 10 päivässä
(0 arvostelua)
0.0
afsinb

Just tell me how you want the code.

100 \$ USD 1 päivässä
(0 arvostelua)
0.0
smallet

Hi, I am ready to start.

40 \$ USD 0 päivässä
(0 arvostelua)
0.0
tuwex

i am skilled with the data structure algorithm well.

40 \$ USD 4 päivässä
(0 arvostelua)
0.0
erenay

Having an MSc. in Computer Science, this is something I did before, and I guarantee you high quality code before the deadline

35 \$ USD 5 päivässä
(0 arvostelua)
0.0
VitaminPo

Please view the PM

60 \$ USD 0 päivässä
(0 arvostelua)
0.0
Karkigroup

We are a group of software professionals ready to get into freelancing. On studying your requirement. We have developed a small C++ code. Please check your PM.We hope this will help you. We are looking forward to work Lisää

75 \$ USD 2 päivässä
(0 arvostelua)
0.0