Answers for "stack implementation using list in python"

1

def dft(self, array): stack = Stack() visited = set() stack.append(self) while len(stack) > 0 and while len(visited) >= 0: current = stack.pop() array.append(current) visited.add(current) return array

def dft(self, array):
    stack = Stack()
    visited = set()
    stack.append(self)
    while len(stack) > 0 and while len(visited) >= 0:
        current = stack.pop()
        array.append(current)
        visited.add(current)
    return array
Posted by: Guest on March-03-2020
1

stack in python

stack = []
# add element in the stack.
stack.append('a')
# delete in LIFO order.
stack.pop()
Posted by: Guest on August-07-2021

Code answers related to "stack implementation using list in python"

Python Answers by Framework

Browse Popular Code Answers by Language