⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pq.py

📁 idel虚拟机源码
💻 PY
字号:
import bisectclass PriorityQueue:	    def __init__(self):	self.queue = []    def append(self, data, priority):	"""Append a new element to the queue according to its priority"""	bisect.insort(self.queue, (priority, data))    def pop(self, n):	"""Pop the highest element of the queue. The n argument is	here to follow the standard queue protocol """			return self.queue.pop(0)    def contains(self, x):	return x in self.queue    def population(self):	return len(self.queue)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -