Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python min function time complexity

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)
 
PREVIOUS NEXT
Tagged: #python #min #function #time #complexity
ADD COMMENT
Topic
Name
1+1 =