All Questions
128 questions
4
votes
4
answers
1k
views
Stack - implementation in Java
I implemented a stack data structure without using any libraries or Java API code.
...
0
votes
1
answer
79
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
212
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 ...
2
votes
0
answers
48
views
JavaScript Linter in Java
I wrote a simple Linter that checks for matching opening and closing braces for one line of JavaScript. It utilizes a stack to store opening braces found in the line, then compares the first closing ...
3
votes
1
answer
575
views
Finding the minimum element of a stack of numbers
As part of an online programming challenge, I wrote a program that implements a stack of integers, supporting adding and removing elements, finding the last inserted element, and the minimum element. ...
1
vote
1
answer
1k
views
Concurrent Queue with enqueue and dequeue using Stack as underlying data structure
This is a mix of data structure and multi threading concept based question. (This is only for understanding and learning purpose) The language for the solution : Java
A Queue with FIFO behavior needs ...
2
votes
2
answers
80
views
Queue By Using Stack
I have implemented a queue by using a stack data structure. How could I improve it?
...
4
votes
1
answer
975
views
Codility Fish (queue) programming challenge
Today I have attempted a Codility exercise "Fish" (https://app.codility.com/programmers/lessons/7-stacks_and_queues/fish/), and I have to say I found it to be:
1) Not necessarily "easy" as implied by ...
13
votes
5
answers
3k
views
Stack class in Java 8
I have a exercise where I have to write a Stack class with the push and pop methods. The code compiles and works as it should. Are there better practices to use in my code? Is there something I should ...
5
votes
2
answers
2k
views
Thread-safe stack in Java with fixed capacity
Implement a multi-threaded stack, with freedom to use existing
implementations of stack. On top of being thread-safe, it must block
(not busy-wait) a pushing thread when stack is full and a ...
3
votes
2
answers
583
views
Leetcode - find if BST is valid or not
Given a binary tree, determine if it is a valid binary search tree
(BST).
Assume a BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the
node's key. The ...
8
votes
3
answers
2k
views
Stack as a Persistent Data Structure Implementation
After reading some articles about immutability, I found out that there are persistent data structures. In the following, I implemented a stack as a persistent data structure.
What I like about the ...
3
votes
2
answers
916
views
Using the stack algorithm for parenthesis matching
I have used Stacks to check for brackets mismatch. (Parentheses matching problem using Stack algorithm)
Any suggestions on how to improve the code?
I have tried various examples and it works ...
1
vote
2
answers
75
views
Stack Array implementation of Java
This is my array implementation on stack in Java. It involves push, pop, get and growth when limit of array size is reached.
I am a self-taught programmer starting to learn data structures and ...
2
votes
2
answers
141
views
LinkedList Stack Implementation
I'm new to the programming and I want to ask a question about my linkedlist stack implementation if it's correct and if it meets the requirements of the linkedlist stack implementation. If there is ...