0%
简介
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
from heapq import * from random import shuffle data = list(range(10)) shuffle(data) heap1 = [] for i in data: heappush(heap1, i)
print(heap1, type(heap1)) heapify(heap1) print(type(heap1))
list_1 = [1,0.2,0.003,0.01,0.03] heappush(list_1,1) print(list_1) heapify(list_1) print(list_1)
|