Question DSA-CX-0022
EasyWhat is the time complexity of a single loop that runs n times and does constant work in each pass?
- A.
O(1)
- B.
O(log n)
- C.
Show answer and explanation
Answer: D
The work grows in direct proportion to n.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Complexity Analysis question
What is the time complexity of a single loop that runs n times and does constant work in each pass?
O(1)
O(log n)
Answer: D
The work grows in direct proportion to n.
O(n²)
O(n)