COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
How to store these data 78, 69, 80, 77, 82, 75 and 81 so that the operation on finding the minimum value will involve shorter processing time?
|
using queue
|
|
using stack
|
|
using vector
|
|
using Binary Search Tree
|
Explanation:
Detailed explanation-1: -To find the minimum identify the leftmost node, i.e. the farthest node you can reach by following only left branches. To find the maximum identify the rightmost node, i.e. the farthest node you can reach by following only right branches. the BST-property.
Detailed explanation-2: -Approach: Just traverse the node from root to left recursively until left is NULL. The node whose left is NULL is the node with the minimum value.
Detailed explanation-3: -The time complexity of the binary search algorithm is O(log n). The best-case time complexity would be O(1) when the central index would directly match the desired value.
There is 1 question to complete.