Questions tagged [stack]
A stack is a last in, first out (LIFO) abstract data type and data structure. Perhaps the most common use of stacks is to store subroutine arguments and return addresses.
413 questions
5
votes
2
answers
358
views
MinMaxStack - tracks minimum and maximum values
I'm implementing a MinMaxStack<T> in C++20 that tracks minimum and maximum values. The class needs T to support ...
3
votes
1
answer
105
views
Simple Stack and Deque implementation (v2)
My previous post: Simple Stack and Deque implementation
I have implemented 2 classes for my project similar to stack and deque. This is my second attempt to get advice and evaluation of my code. Maybe ...
1
vote
1
answer
156
views
Simple Stack and Deque implementation
I implemented a single-linked and double-linked lists (like stack and deque). I would like to receive your feedback on improving the code or maybe some comments. I'm learning C++ for the third month. ...
5
votes
2
answers
520
views
naive C++ stack template class
I just learned Adapter Pattern, and I have used STL for some time. I know that the std::stack is a adapter for sequence container (say, ...
4
votes
4
answers
2k
views
Stack - implementation in Java
I implemented a stack data structure without using any libraries or Java API code.
...
2
votes
2
answers
157
views
Generic stack implementation (revision)
The below post is a follow-up of Generic stack implementation.
Below follows a header-only implementation of a generic stack (inspired by stb-libraries, following these guidelines: stb-howto.txt). ...
3
votes
1
answer
265
views
Generic stack implementation
The provided code (a header-only library inspired by stb libraries] defines functions for creating a stack, pushing elements onto the stack, popping elements from the stack, peeking at the top element ...
10
votes
5
answers
2k
views
Detecting balanced parentheses
Objective:
Given a string s containing '(', ')', '{', '}', '[', ']' (and other
characters), determine if the input string is valid.
An input string is valid if:
...
3
votes
2
answers
150
views
Functions to simplify printing strings and numbers in amd64 Assembly
I'm new to Assembly, and this is my very first "project" in Assembly. I wanted to store data (numbers) on the stack, then access and display them. Eventually, this "experiment" of ...
3
votes
1
answer
198
views
`strdup` re-implementation in assembly
I am posting a message here because I am new to assembly programming. My goal today was to re-code strdup in assembly, so to save my first parameter which is a ...
1
vote
4
answers
867
views
Stack using doubly linked list
I have implemented my stack based on a doubly linked list. The code is tested and works; however, I am interested in any improvement ideas.
...
1
vote
3
answers
220
views
Simple stack of integers
I've a simple push/pop implementation in my program:
...
0
votes
1
answer
91
views
Delayed, concurrent event stack in Java - follow-up
I have slightly refactored the Delayed, concurrent event stack in Java. Now it looks like this:
DelayedEventStack.java
...
0
votes
3
answers
233
views
Delayed, concurrent event stack in Java
(See the next iteration:
Delayed, concurrent event stack in Java - follow-up )
Motivation
I was confronted with a task of having "message events" for a GUI program. The use case is as ...
4
votes
1
answer
192
views
Queue implemented using two stacks in Swift
I need your expert opinion! In fact, for a Leetcode Problem, I had to code a queue using 2 stacks. It's shown just below and functions well.
It is a pretty simple code with peek, pop, push, etc. ...