Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  A Binary Search Tree (BST) stores values in t... Start Learning for Free
A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys. 
I. 81, 537, 102, 439, 285, 376, 305 
II. 52, 97, 121, 195, 242, 381, 472 
III. 142, 248, 520, 386, 345, 270, 307 
IV. 550, 149, 507, 395, 463, 402, 270 

Q. Which of the following statements is TRUE?
  • a)
    I, II and IV are inorder sequences of three different BSTs
  • b)
    I is a preorder sequence of some BST with 439 as the root
  • c)
    II is an inorder sequence of some BST where 121 is the root and 52 is a leaf
  • d)
    IV is a postorder sequence of some BST with 149 as the root
Correct answer is option 'C'. Can you explain this answer?
Verified Answer
A Binary Search Tree (BST) stores values in the range 37 to 573. Consi...
A: I and IV are not in ascending order 
B: If 439 is root, It should be 1st element in preorder 
D: IV is a postorder sequence of some BST with 149 as the root, => False
View all questions of this test
Most Upvoted Answer
A Binary Search Tree (BST) stores values in the range 37 to 573. Consi...
Binary Search Tree (BST) and given sequences

A Binary Search Tree (BST) is a tree data structure in which each node has at most two children, left and right, and the value of the left child is less than or equal to the value of the node, and the value of the right child is greater than or equal to the value of the node.

The given sequences of keys are as follows:

I. 81, 537, 102, 439, 285, 376, 305
II. 52, 97, 121, 195, 242, 381, 472
III. 142, 248, 520, 386, 345, 270, 307
IV. 550, 149, 507, 395, 463, 402, 270

Analysis of sequences

Let's analyze each sequence and check which statement is true.

I. 81, 537, 102, 439, 285, 376, 305

This sequence is not sorted in ascending or descending order. Therefore, we cannot directly say that this sequence is an inorder sequence of a BST. However, we can say that this sequence can be a preorder or postorder sequence of some BST. Hence, statement (a) is not true. Also, there is no information about the root of the BST. Therefore, statement (b) is also not true. Hence, the answer cannot be option (a) or (b).

II. 52, 97, 121, 195, 242, 381, 472

This sequence is sorted in ascending order, and the root of the BST must be the middle element of the sequence. Therefore, the root of the BST is 195. Also, the left subtree of the root consists of elements 52, 97, and 121, and the right subtree of the root consists of elements 242, 381, and 472. Hence, this sequence is an inorder sequence of a BST where 121 is the root and 52 is a leaf. Thus, statement (c) is true, and the answer is option (C).

III. 142, 248, 520, 386, 345, 270, 307

This sequence is not sorted in ascending or descending order. Therefore, we cannot directly say that this sequence is an inorder sequence of a BST. Also, there is no information about the root of the BST. Hence, statement (b) is not true. Therefore, the answer cannot be option (a) or (b).

IV. 550, 149, 507, 395, 463, 402, 270

This sequence is sorted in descending order. Therefore, we can say that this sequence is a postorder sequence of a BST. However, we cannot say anything about the root of the BST. Therefore, statement (d) is not true. Hence, the answer cannot be option (d).

Conclusion

Hence, we can conclude that statement (c) is true, and the answer is option (C).
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys.I. 81, 537, 102, 439, 285, 376, 305II. 52, 97, 121, 195, 242, 381, 472III. 142, 248, 520, 386, 345, 270, 307IV. 550, 149, 507, 395, 463, 402, 270Q. Which of the following statements is TRUE?a)I, II and IV are inorder sequences of three different BSTsb)I is a preorder sequence of some BST with 439 as the rootc)II is an inorder sequence of some BST where 121 is the root and 52 is a leafd)IV is a postorder sequence of some BST with 149 as the rootCorrect answer is option 'C'. Can you explain this answer?
Question Description
A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys.I. 81, 537, 102, 439, 285, 376, 305II. 52, 97, 121, 195, 242, 381, 472III. 142, 248, 520, 386, 345, 270, 307IV. 550, 149, 507, 395, 463, 402, 270Q. Which of the following statements is TRUE?a)I, II and IV are inorder sequences of three different BSTsb)I is a preorder sequence of some BST with 439 as the rootc)II is an inorder sequence of some BST where 121 is the root and 52 is a leafd)IV is a postorder sequence of some BST with 149 as the rootCorrect answer is option 'C'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys.I. 81, 537, 102, 439, 285, 376, 305II. 52, 97, 121, 195, 242, 381, 472III. 142, 248, 520, 386, 345, 270, 307IV. 550, 149, 507, 395, 463, 402, 270Q. Which of the following statements is TRUE?a)I, II and IV are inorder sequences of three different BSTsb)I is a preorder sequence of some BST with 439 as the rootc)II is an inorder sequence of some BST where 121 is the root and 52 is a leafd)IV is a postorder sequence of some BST with 149 as the rootCorrect answer is option 'C'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys.I. 81, 537, 102, 439, 285, 376, 305II. 52, 97, 121, 195, 242, 381, 472III. 142, 248, 520, 386, 345, 270, 307IV. 550, 149, 507, 395, 463, 402, 270Q. Which of the following statements is TRUE?a)I, II and IV are inorder sequences of three different BSTsb)I is a preorder sequence of some BST with 439 as the rootc)II is an inorder sequence of some BST where 121 is the root and 52 is a leafd)IV is a postorder sequence of some BST with 149 as the rootCorrect answer is option 'C'. Can you explain this answer?.
Solutions for A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys.I. 81, 537, 102, 439, 285, 376, 305II. 52, 97, 121, 195, 242, 381, 472III. 142, 248, 520, 386, 345, 270, 307IV. 550, 149, 507, 395, 463, 402, 270Q. Which of the following statements is TRUE?a)I, II and IV are inorder sequences of three different BSTsb)I is a preorder sequence of some BST with 439 as the rootc)II is an inorder sequence of some BST where 121 is the root and 52 is a leafd)IV is a postorder sequence of some BST with 149 as the rootCorrect answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys.I. 81, 537, 102, 439, 285, 376, 305II. 52, 97, 121, 195, 242, 381, 472III. 142, 248, 520, 386, 345, 270, 307IV. 550, 149, 507, 395, 463, 402, 270Q. Which of the following statements is TRUE?a)I, II and IV are inorder sequences of three different BSTsb)I is a preorder sequence of some BST with 439 as the rootc)II is an inorder sequence of some BST where 121 is the root and 52 is a leafd)IV is a postorder sequence of some BST with 149 as the rootCorrect answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys.I. 81, 537, 102, 439, 285, 376, 305II. 52, 97, 121, 195, 242, 381, 472III. 142, 248, 520, 386, 345, 270, 307IV. 550, 149, 507, 395, 463, 402, 270Q. Which of the following statements is TRUE?a)I, II and IV are inorder sequences of three different BSTsb)I is a preorder sequence of some BST with 439 as the rootc)II is an inorder sequence of some BST where 121 is the root and 52 is a leafd)IV is a postorder sequence of some BST with 149 as the rootCorrect answer is option 'C'. Can you explain this answer?, a detailed solution for A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys.I. 81, 537, 102, 439, 285, 376, 305II. 52, 97, 121, 195, 242, 381, 472III. 142, 248, 520, 386, 345, 270, 307IV. 550, 149, 507, 395, 463, 402, 270Q. Which of the following statements is TRUE?a)I, II and IV are inorder sequences of three different BSTsb)I is a preorder sequence of some BST with 439 as the rootc)II is an inorder sequence of some BST where 121 is the root and 52 is a leafd)IV is a postorder sequence of some BST with 149 as the rootCorrect answer is option 'C'. Can you explain this answer? has been provided alongside types of A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys.I. 81, 537, 102, 439, 285, 376, 305II. 52, 97, 121, 195, 242, 381, 472III. 142, 248, 520, 386, 345, 270, 307IV. 550, 149, 507, 395, 463, 402, 270Q. Which of the following statements is TRUE?a)I, II and IV are inorder sequences of three different BSTsb)I is a preorder sequence of some BST with 439 as the rootc)II is an inorder sequence of some BST where 121 is the root and 52 is a leafd)IV is a postorder sequence of some BST with 149 as the rootCorrect answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys.I. 81, 537, 102, 439, 285, 376, 305II. 52, 97, 121, 195, 242, 381, 472III. 142, 248, 520, 386, 345, 270, 307IV. 550, 149, 507, 395, 463, 402, 270Q. Which of the following statements is TRUE?a)I, II and IV are inorder sequences of three different BSTsb)I is a preorder sequence of some BST with 439 as the rootc)II is an inorder sequence of some BST where 121 is the root and 52 is a leafd)IV is a postorder sequence of some BST with 149 as the rootCorrect answer is option 'C'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev