adplus-dvertising
frame-decoration

Question

What is wrong with below code for inorder traversal of inorder threaded binary tree:
 inordertraversal(threadedtreenode root):
   threadedtreenode q = inorderpredecessor(root)
   while(q!=root):
   q=inorderpredecessor(q)
   print q.data

a.

inordersuccessor instead of inorderpredecessor must be done

b.

code is correct

c.

it is code for post order

d.

it is code for pre order

Answer: (a).inordersuccessor instead of inorderpredecessor must be done

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is wrong with below code for inorder traversal of inorder threaded binary tree:

Similar Questions

Discover Related MCQs

Q. In a max-heap, element with the greatest key is always in the which node?

Q. Heap exhibits the property of a binary tree?

Q. What is the complexity of adding an element to the heap.

Q. The worst case complexity of deleting any arbitrary node value element from heap is

Q. Heap can be used as ________________

Q. An array consist of n elements. We want to create a heap using the elements. The time complexity of building a heap will be in order of

Q. What is the space complexity of searching in a heap?

Q. What is the best case complexity in builading a heap?

Q. What is the location of parent node for any arbitary node i?

Q. Given an array of element 5,7,9,1,3,10,8,4. Tick all the correct sequences of elements after inserting all the elements in a min-heap.

Q. Choose the correct properties of weak-heap.

Q. Left child of parent node has value lesser than the parent node.

Q. What is the other name of weak heap?

Q. What is the worst case time in searching minimum value in weak -heap?

Q. The total comparisons in finding both smallest and largest elements are

Q. Does there exist a heap with seven distinct elements so that the Inorder traversal gives the element in sorted order.

Q. The leaf node for a heap of height h will be at which position.

Q. The main distinguishable characterstic of a binomial heap from a binary heap is that

Q. The number of trees in a binomial heap with n nodes is

Q. In a binomial heap the root value is greater than left child and less than right child.