def push(self, item): ## Regular stack n1 = Node(item) n1.next = self.top self.top = n1 ##stack maintaing minimum if self.topMinimum == []: self.topMinimum.append(item) else: if item < self.topMinimum[len(self.topMinimum) - 1]: self.topMinimum.append(item) else: self.topMinimum.append(self.topMinimum[len(self.topMinimum) - 1])
def push(self,item): self.size=self.size+1 n1=Node(item) n1.next=self.top self.top=n1