| 5 | import math |
| 6 | import random |
| 7 | class my_queue: |
| 8 | def __init__(self): |
| 9 | self.data = [] |
| 10 | self.head = 0 |
| 11 | self.tail = 0 |
| 12 | def isEmpty(self): |
| 13 | return self.head == self.tail |
| 14 | def push(self,data): |
| 15 | self.data.append(data) |
| 16 | self.tail = self.tail + 1 |
| 17 | def pop(self): |
| 18 | ret = self.data[self.head] |
| 19 | self.head = self.head + 1 |
| 20 | return ret |
| 21 | def count(self): |
| 22 | return self.tail - self.head |
| 23 | def print(self): |
| 24 | print(self.data) |
| 25 | print("**************") |
| 26 | print(self.data[self.head:self.tail]) |
| 27 | |
| 28 | class my_node: |
| 29 | def __init__(self,data): |