摘要: 用Python实现堆排序 1 # -*- coding: utf-8 -*- 2 3 #程序作用:实现最大堆排序 4 import sys 5 def left_child(node): 6 return node*2+1 7 def right_child(node): 8 re... 阅读全文
posted @ 2015-11-22 18:12 YanZL 阅读(200) 评论(0) 推荐(0)
摘要: 1. python中的优先权队列,priorityqueue用法:数字越小,表示优先级越高,越早被拿出from queue import Queuefrom queue import PriorityQueueprioqueue=PriorityQueue()prioqueue.put((1,'ha... 阅读全文
posted @ 2015-11-22 18:10 YanZL 阅读(247) 评论(0) 推荐(0)