摘要:
a=[5,4,2,3,1]print(a)n=len(a)l=0r=n-1while True: if a[l]>a[r]: a[l],a[r]=a[r],a[l] r=r-1 if l==r: l=l+1 ... 阅读全文
摘要:
import heapq#-*- coding: UTF-8 -*-import numpy as npdef MakeHeap(a): for i in range(int(a.size / 2) - 1, -1, -1):#对非叶子节点的子节点进行... 阅读全文
摘要:
#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Tue Jun 26 22:32:27 2018@author: luogan"""class Node(object): def _... 阅读全文