mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-06 22:34:18 +08:00
Polish the content
Polish the chapter preface, introduction and complexity anlysis
This commit is contained in:
@ -35,9 +35,9 @@ def linear(n: int):
|
||||
# 长度为 n 的列表占用 O(n) 空间
|
||||
nums = [0] * n
|
||||
# 长度为 n 的哈希表占用 O(n) 空间
|
||||
mapp = dict[int, str]()
|
||||
hmap = dict[int, str]()
|
||||
for i in range(n):
|
||||
mapp[i] = str(i)
|
||||
hmap[i] = str(i)
|
||||
|
||||
|
||||
def linear_recur(n: int):
|
||||
|
@ -61,7 +61,7 @@ def exponential(n: int) -> int:
|
||||
"""指数阶(循环实现)"""
|
||||
count = 0
|
||||
base = 1
|
||||
# cell 每轮一分为二,形成数列 1, 2, 4, 8, ..., 2^(n-1)
|
||||
# 细胞每轮一分为二,形成数列 1, 2, 4, 8, ..., 2^(n-1)
|
||||
for _ in range(n):
|
||||
for _ in range(base):
|
||||
count += 1
|
||||
|
Reference in New Issue
Block a user