Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



Assertion: Binary search tree property allow to print all keys in binary search tree in sorted order by simple recursive algorithm called inorder tree walk.

Reason: The inorder tree walk algorithm print the key root of subtree between printing value in its left subtree and printing those in its right subtree.

Options:

(a) Assertion is true, Reason is true, and Reason is the correct explanation of the Assertion.

(b) Assertion is true, Reason is true, but Reason is not the correct explanation of the Assertion.

(c) Assertion is true, but Reason is false.

(d) Assertion is false, but Reason is true.






Solution

In a Binary Search Tree (BST), all keys in the left subtree are smaller than the root and all keys in the right subtree are larger than the root.

Inorder traversal follows the order:
Left Subtree → Root → Right Subtree

Because of the BST property, this traversal prints the elements in sorted order.

The reason correctly explains the inorder traversal process where the root is printed between its left and right subtree.

Correct Answer: (a) Assertion is true, Reason is true, and Reason is the correct explanation of the Assertion.



Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...