CT16数据结构.pptVIP

  • 7
  • 0
  • 约4.05千字
  • 约 17页
  • 2017-08-15 发布于河南
  • 举报
用Python的列表实现堆栈 class Stack : def __init__(self) : self.items = [] def push(self, item) : self.items.append(item) def pop(self) : return self.items.pop() def isEmpty(self) : return (self.items == []) s = Stack() s.push(54) s.push(45) s.push(+) while not s.isEmpty(): print s.pop(), 用Python实现链接队列 class Queue: def __init__(self): self.length = 0 self.head = None def isEmpty(self): return (self.length == 0) 用Python实现链接队列(续) class Queue: ... def insert(self, data): node = Node(data)

文档评论(0)

1亿VIP精品文档

相关文档