MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / Stack

Class Stack

Python/queue via stack.py:3–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1# implement a queue using two stacks
2
3class Stack():
4 def __init__(self):
5 self.list=[]
6
7 def __len__(self):
8 return len(self.list)
9
10 def push(self,item):
11 self.list.append(item)
12
13 def pop(self):
14 if len(self.list)==0:
15 return None
16 return self.list.po()
17
18class QueueviaStack():
19 def __init__(self):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected