# MCQ IN COMPUTER SCIENCE & ENGINEERING

## COMPUTER SCIENCE AND ENGINEERING

### DATA STRUCTURES

 Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
If for an algorithm time complexity is given by O(n) then complexity of it is:
 A linear B exponential C constant D none of the mentioned
Explanation:

Detailed explanation-1: -Explanation: It is O(n), therefore complexity will be linear.

Detailed explanation-2: -Constant Time Complexity: O(1) When an algorithm has constant time with order O (1) and is independent of the input size n, it is said to have constant time with order O (1).

Detailed explanation-3: -Linear Time: O(n) You get linear time complexity when the running time of an algorithm increases linearly with the size of the input. This means that when a function has an iteration that iterates over an input size of n, it is said to have a time complexity of order O(n).

Detailed explanation-4: -Big O Notation is a tool used to describe the time complexity of algorithms. It calculates the time taken to run an algorithm as the input grows. In other words, it calculates the worst-case time complexity of an algorithm. Big O Notation in Data Structure describes the upper bound of an algorithmâ€™s runtime.

Detailed explanation-5: -Linear search makes n/2 comparisons on an average where n is the number of elements. At the most, linear search takes n comparisons. So, overall complexity in the worst case of linear search algorithm is O(n).

There is 1 question to complete.