''' mbinary ######################################################################### # File : leftHeap.py # Author: mbinary # Mail: zhuheqin1@gmail.com # Blog: https://mbinary.xyz # Github: https://github.com/mbinary # Created Time: 2018-05-19 23:06 # Description: ######################################################################### ''' from functools import total_ordering @total_ordering class node: def __init__(self,val,freq=1,s=1,left=None,right=None): self.val=val self.freq=freq self.s=s if left is None or right is None: self.left = left if left is not None else right self.right =None else: if left.s int if root is None:return t if t is None:return root if root