The stack tag has no wiki summary.
0
votes
0answers
52 views
procedural representation for the stack? (LIFO structure)
I'm trying to do the exercise 2.12 of the book Essential of programing languages 3rd edition.
They ask me to do a procedural representation for a stack, like they did in the example of page 40 with ...
1
vote
1answer
141 views
Efficient algorithm for a modified stack to pop the smallest element
I was practicing the following problem :
There are a total of $N$ operations.
At each operation, you can either add an element to the top or remove several elements as described below.
...
1
vote
1answer
49 views
A puzzle in Permutation
There are two stacks A and B.
A : a,b,c,d ('a' is on top and 'd' is at the bottom of the stack)
B : (empty)
There are two rules.
...
1
vote
2answers
70 views
Using Queues for a Stack and Stacks for a Queue
I was asked a question on how to use a pair of Queues to create a Stack and how to use a pair of Stacks to create a Queue. Any thoughts on how I would do this? Right now I don't even know where to ...
6
votes
1answer
176 views
How to detect stack order?
We take the sequence of integers from $1$ to $n$, and we push them onto a stack one by one in order. Between each push, we can choose to pop any number of items from the stack (from 0 to the current ...
14
votes
0answers
430 views
Is there a 'string stack' data structure that supports these string operations?
I'm looking for a data structure that stores a set of strings over a character set $\Sigma$, capable of performing the following operations. We denote $\mathcal{D}(S)$ as the data structure storing ...