COMPUTER SCIENCE AND ENGINEERING
ALGORITHMS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
What is the Big-O Notation of a combination lock with 4 digits, each digit having 1 of 10 possible values?
|
O(n)
|
|
O(10n)
|
|
O(log n)
|
|
O(n2)
|
|
O(1)
|
Explanation:
Detailed explanation-1: -For example, n² grows faster than n, so if we have something like g(n) = n² + 5n + 6, it will be big O(n²).
Detailed explanation-2: -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-3: -The most common complexity classes are (in ascending order of complexity): O(1), O(log n), O(n), O(n log n), O(n²).
There is 1 question to complete.