def find_min(self):
"""找最小值,返回键值元组"""
if self.is_empty():
return None
else:
p = self.first()
return(p.key(), p.value())
def find_ge(self, k):
"""找第一个大于等于k的键值元组"""
if self.is_empty():
return None
else:
p = self.find_position(k)
if p.key() < k:
p = self.after(p)
return (p.key(), p.value()) if p is not None else None
def find_range(self, start, stop):
if not self.is_empty():
if start is None:
p = self.first()
else:
p = self.find_position(start)
if p.key() < start:
p = self.after(p)
while p is not None and (stop is None or p.key() < stop):
yield (p.key(), p.value())
p = self.after(p)
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx