本文整理汇总了Python中stack.Stack.checkSize方法的典型用法代码示例。如果您正苦于以下问题:Python Stack.checkSize方法的具体用法?Python Stack.checkSize怎么用?Python Stack.checkSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stack.Stack
的用法示例。
在下文中一共展示了Stack.checkSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: myQueue
# 需要导入模块: from stack import Stack [as 别名]
# 或者: from stack.Stack import checkSize [as 别名]
from queue import myQueue
print "Test Queue: Add 10 Integers to Queue"
testQueue = myQueue()
for i in range(10):
testQueue.put(i)
while not testQueue.empty():
print testQueue.get()
from stack import Stack
print "\nTest Stack: Add 10 Integers to a stack then pop"
testStack = Stack()
for i in range(10):
testStack.push(i)
while testStack.checkSize() > 0:
print testStack.pop()
from binaryTree import Tree
testTree = Tree(0)
print "\nTest Tree: Add 10 integers as nodes to the tree"
for i in range(1,11):
testTree.add(i,i-1)
testTree.treeprint(testTree)
print "\nTest Tree: Delete 2 integers from the tree"
testTree.delete(10)
testTree.delete(9)
testTree.treeprint(testTree)
from graph import Graph
testGraph = Graph()
print "\nTest Graph: Add 10 integers as vertices to the graph"
for i in range(10):