Q1) O (1) Time Complexity in Loops:: // Here C Is A Constant
Q1) O (1) Time Complexity in Loops:: // Here C Is A Constant
Q1) O (1) Time Complexity in Loops:: // Here C Is A Constant
Time complexity of a function (or set of statements) is considered as O(1) if it doesn’t contain loop,
recursion and call to any other non-constant time function.
A loop or recursion that runs a constant number of times is also considered as O(1). For example the
following loop is O(1).
Q3) O(nc) complexity in loops: Time complexity of nested loops is equal to the number of times the
innermost statement is executed. For example the following sample loops have O(n 2) time complexity