Role of left thread in inorder traversal

  • Thread starter Thread starter zak100
  • Start date Start date
  • Tags Tags
    Thread
AI Thread Summary
The discussion centers on the role of the left thread in inorder traversal of a threaded binary tree. It is concluded that the left thread is not necessary for standard inorder traversal, which follows a left-to-right sequence. However, if considering a broader interpretation of inorder that includes reverse traversal, the left thread becomes relevant. Participants clarify that while traditional inorder does not utilize the left thread, it can facilitate reverse traversal. Ultimately, the left thread's significance depends on the specific definition of inorder traversal being applied.
zak100
Messages
462
Reaction score
11

Homework Statement


Hi,

I want to know is there any role for left thread in inorder traversal.

Homework Equations


There is no equation but there is an example image of the tree which is attached. After traversal we would get:
Start at leftmost node, print it (1)

Follow thread to right, print node (3)

Follow link to right, go to leftmost node and print (5)

Follow thread to right, print node (6)

Follow link to right, go to leftmost node and print (7)

Follow thread to right, print node (8)

Follow link to right, go to leftmost node and print (9)

Follow thread to right, print node (11)

Follow link to right, go to leftmost node and print (13)

The Attempt at a Solution


The above traversal of threaded binary tree does not show any role of left thread in inorder traversal.
So i don't think that there is any role of left thread in inorder traversal.
Some body please guide me.

Zulfi.
example.jpg
 
Physics news on Phys.org
zak100 said:
i don't think that there is any role of left thread in inorder traversal.
I believe the left thread would be used for reverse order traversal. A threaded binary tree can be single threaded or double threaded.
 
Hi,
Thanks for your response.
What you mean by reverse order traversal? I don't think its same as inorder. I am just talking about inorder traversal in my question. Kindly tell me in the context of inorder traversal whether left thread is involved or not?

Zulfi.
 
zak100 said:
What you mean by reverse order traversal?
I mean the reverse order from inorder. it allows you to traverse the tree in reverse order.
See http://btechsmartclass.com/DS/U3_T5.html
zak100 said:
tell me in the context of inorder traversal whether left thread is involved or not?
It depends what you mean by inorder traversal. If you only mean going from first to last then the left thread is not needed, but if you interpret "inorder" as just defining an ordering on the elements then it is valid to want to be able to traverse it in either direction. In that view, it is an "inorder reverse traversal", and the left thread is needed.
 
Hi,
Thanks for removing my confusion.
Zulfi.
 

Similar threads

Back
Top