- 博客(1)
- 收藏
- 关注
原创 python学习数据结构heapq
>>> import heapq>>> nums = [1, 8, 2, 23, 7, -4, 18, 23, 42, 37, 2]>>> print(heapq.nlargest(3, nums)) # Prints [42, 37, 23][42, 37, 23]>>> print(heapq.nsmallest(3, nums)) # Prints [-4, 1, 2][
2017-12-28 17:05:57 143
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人