• retagged by
1,001 views
0 0 votes

Consider the following algorithm:


ORDER (T)
begin
if (T!=NULL) then
begin
ORDER (LPTR(T))
PRINT (DATA(T))
ORDER (RPTR(T))
end
return
end

where LPTR: left pointer
RPTR: right pointer
T: given tree


This above algorithm is used to:

  1.   Traverse the tree in preorder in a recursive manner
  2.   Traverse the tree in in-order, in a recursive manner
  3.   Traverse the tree in post-order in a recursive manner
  4.    Do not Traverse the tree at all

1 Answer

Best answer
1 1 vote
It's a recursive code for inorder traversal.
• selected by
Answer:
Position:
Show:

Related questions

2 2 votes
1 answers 1 answer
2.5k
2.5k views
Bikram asked Jan 16, 2017
2,465 views
Fill in the blanks in the procedure:void Prod (Element Type X, Priority Queue H) { int i; if (IsFull(H)) { Error ("Priority queue is full"); return; } for (i=++H - size; ...
6 6 votes
2 answers 2 answers
1.5k
1.5k views
Bikram asked Jan 16, 2017
1,547 views
Hash a list of $3$ keys into hash table with $20$ locations. What will be the probability of the event $A$ in which hashing the three keys causes a collision?$0.123$$0.14...
1 1 vote
2 answers 2 answers
870
870 views
Bikram asked Feb 9, 2017
870 views
A ternary tree is a tree in which every internal node has exactly three children.The number of leaves in a ternary tree with $’z’$ internal nodes is _______.$2$$\left ( z...
0 0 votes
2 answers 2 answers
598
598 views
Bikram asked Feb 9, 2017
598 views
A complete binary tree can be stored in an array.If index starts at $1$, to access the child of $i^{th}$ node, the _____$^{th}$ and _____ $^{th}$ index of array needs t...