单选题:下述Python程序段的时间复杂度为( )
下述程序段的时间复杂度为( )
i=1
while i<=n:
i=i*2
### 来源:
黄龙军, 等. 数据结构与算法(Python语言描述), 上海: 上海交通大学出版社, 2023. (In Press)
A.O(log$$_2$$n)
B.O(n)
C.O($$\sqrt{n}$$)
D.O(n$$^2$$)
答案:A
i=1
while i<=n:
i=i*2
### 来源:
黄龙军, 等. 数据结构与算法(Python语言描述), 上海: 上海交通大学出版社, 2023. (In Press)
A.O(log$$_2$$n)
B.O(n)
C.O($$\sqrt{n}$$)
D.O(n$$^2$$)
答案:A