📜  python min 函数时间复杂度 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:07.624000             🧑  作者: Mango

代码示例1
import heapq
import random

sample = [random.randint(0, 1000) for _ in range(100)]
print(min(sample)) # O(N)

heapq.heapify(sample) # O(N)
print(sample[0]) # O(1)