Tag:Layer number

  • PAT 1094 The Largest Generation


    1094 the largest generation (25 points) A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest population. Input Specification: Each input file contains one test case. Each case starts with two positive […]

  • How to realize Hanoi tower with Python


    Using animation to realize Hanoi Tower problem: import turtle class Stack: def __init__(self): self.items = [] def isEmpty(self): return len(self.items) == 0 def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): if not self.isEmpty(): return self.items[len(self.items) – 1] def size(self): return len(self.items) Def drawpole 3(): draw the poles of Hanoi Tower t = turtle.Turtle() […]