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

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.