COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
O(n) means that your algorithm will take on the order of ____ operations to find the minimum item
|
n2
|
|
n-1
|
|
n
|
|
None of the above
|
Explanation:
Detailed explanation-1: -Hence, 4 steps are needed to reduce N to 0.
Detailed explanation-2: -Return max and min. Time Complexity is O(n) and Space Complexity is O(1). For each pair, there are a total of three comparisons, first among the elements of the pair and the other two with min and max.
Detailed explanation-3: -The minimum number of operations required is 2.
There is 1 question to complete.