Recr_4 Identify the recurrence relation for the binary_search function described below, which recursively searches for a value in a sorted list. 单项选择题

A

T(n) = \begin{cases} \Theta(1) & \text{if } n <2 \\2T\left(n-1\right) + \Theta(1) & \text{otherwise}\end{cases}

B

T(n) = \begin{cases} \Theta(1) & \text{if } n <2 \\T\left(n-1\right) + \Theta(n) & \text{otherwise}\end{cases}

C

T(n) = \begin{cases} \Theta(1) & \text{if } n <2 \\2T\left(\frac{n}{2}\right) + \Theta(1) & \text{otherwise}\end{cases}

D

T(n) = \begin{cases} \Theta(1) & \text{if } n <2 \\T\left(\frac{n}{2}\right) + \Theta(1) & \text{otherwise}\end{cases}

E

T(n) = \begin{cases} \Theta(1) & \text{if } n <2 \\T\left(\frac{n}{2}\right) + \Theta(n) & \text{otherwise}\end{cases}

F

T(n) = \begin{cases} \Theta(1) & \text{if } n <2 \\T\left(n-1\right) + \Theta(1) & \text{otherwise}\end{cases}

登录即可查看完整答案

我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。

类似问题

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!