Back to the 2024 paper

Module 1: Introduction

20242m

The recurrence T(n)=T(n/2)+1T(n) = T(n/2) + 1 has a time complexity of:
(i) O(n)O(n)
(ii) O(log⁡n)O(\log n)
(iii) O(nlog⁡n)O(n \log n)
(iv) O(n2)O(n^2)

Worked SolutionAI Assisted

Answer: (ii) O(log n)

Master theorem: a=1,b=2,f=1,n^{log_b a}=1 → case 2 with f=Θ(n^{0}) → Θ(log n).

Similar questions

Budget AppAndroid App

Pocketly on Android

Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.