MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The main rules for BST are as below except
A
Items of the left subtree < x
B
Items of the right subtree > = x
C
Items of the left subtree > x
D
None of the above
Explanation: 

Detailed explanation-1: -A binary search tree is a binary tree with a special property called the BST-property, which is given as follows: ⋆ For all nodes x and y, if y belongs to the left subtree of x, then the key at y is less than the key at x, and if y belongs to the right subtree of x, then the key at y is greater than the key at x.

Detailed explanation-2: -Definition. A binary search tree (BST) is a binary tree where every node in the left subtree is less than the root, and every node in the right subtree is of a value greater than the root. The properties of a binary search tree are recursive: if we consider any node as a “root, ” these properties will remain true.

Detailed explanation-3: -The leftmost node in BST always has the smallest value and the rightmost node in BST always has the largest value. So, from the given array we just need to find the minimum value for the leftmost node and the maximum value for the rightmost node.

There is 1 question to complete.