Skip to main content

Questions tagged [queue]

A queue is an ordered, first-in-first-out (FIFO) data structure. Typical implementations of queues support pushing elements to the back and popping them off the front position.

Filter by
Sorted by
Tagged with
4 votes
1 answer
296 views

Basic queue implementation in C

I'm practicing data structures in C and I implemented a queue based on its description: ...
aderchox's user avatar
  • 207
4 votes
1 answer
251 views

Node.JS Server Queue Processor

I implemented a simple queuing system for my Node.JS app and wanted a critique on it's structure. ...
Enijar's user avatar
  • 175
4 votes
1 answer
540 views

Javascript Queue Object

I created a Queue object when answering this question and I was wondering if it could do with some improvement. Here is the current code: ...
Naftali's user avatar
  • 1,089
4 votes
0 answers
448 views

Queue with "unlimited" buffer in Go

This is small piece of bigger puzzle, but usable by its own. It an attempt to have a nonblocking queue with "unlimited" (besides memory size) buffer length. Got unit-tests 100% statement coverage, it ...
canni's user avatar
  • 211
3 votes
4 answers
3k views

Implementation of a deque using an array in Python 3

I created this double-ended queue using list. I supported the standard operations such as push, ...
Taimoor Ahmad's user avatar
3 votes
2 answers
638 views

Circular Queue in C for an embedded project

I wrote a simple circular queue. (in order to store characters because of the fact, that I am using UART through the DMA and sometimes my printf's override each other) I am looking for some review, ...
Town Tattle's user avatar
3 votes
2 answers
12k views

Circular Queue Implementation Using Array in java

Here is my code of Array Implementation of Queue in java. ...
Sagar Devkota's user avatar
3 votes
2 answers
1k views

Python stack and queue classes, implemented using lists

I have made a stack and queue implementation with OOP in Python (sorry for variable names) . It is made from scratch. I just watched a video how these two things work. I am still trying to improve in ...
P. Bolfa's user avatar
  • 261
3 votes
3 answers
10k views

Priority Queue in C#

I develop a small game using C# and need A* in it. For that, I need a PriorityQueue, which .NET does not have. I wanted to make my own one for practice. Here is it, please comment on performance and ...
PhilippHochmann's user avatar
3 votes
4 answers
964 views

A more efficient enqueue algorithm in Java

So I have this simple code in Java. It enqueue (adds) and element to the end of the queue (implemented by an ArrayList) without ...
MandM's user avatar
  • 31
3 votes
2 answers
450 views

C++ workqueue class

This is a nice workqueue class template to keep the gui fluid, while data is being written into a database or into some file/network... ...
user1095108's user avatar
  • 1,434
3 votes
2 answers
295 views

Queue using Stack

I implemented this solution for the problem. Please provide feedback and review if this can be improved in any way. ...
Neelesh Salian's user avatar
3 votes
3 answers
108 views

Threadsafe get method on queue that draws values from other queues?

I have a class that implements Queue and draws values from other queues which may still be referenced outwith it. I want my method to draw values from the contained queues, using synchronized locks on ...
Hanii Puppy's user avatar
3 votes
2 answers
12k views

Queue Implementation

First time I'm using stackexchange. I'm in 8th standard. I tried to implement Queue in Java. I wrote something like this> Right now I'm not able to test it because I don't have JVM in my machine. So I ...
Kiran's user avatar
  • 31
3 votes
2 answers
399 views

Generic concurrent bounded buffer in C

I just implemented a generic concurrent queue in C, and I'd like some feedback on my implementation, as well as the logic in handling generic data and concurrency. buffer.h ...
Samuele B.'s user avatar
3 votes
1 answer
108 views

Queue implementation using two stacks

Here's my code and I want to know if there's a better method for doing so. While the question has stated two stacks I wonder if we could do only with one as well? ...
Mona Jalal's user avatar
3 votes
2 answers
351 views

Lockless SCSP queue

I'm looking for a code review on a class that I've written. It was my first attempt at lockless programming and I'd love any feedback I can get. ...
Joshua Waring's user avatar
3 votes
1 answer
4k views

Sum of left and right nodes (individually) in a Binary Search Tree

I have written a program which calculates the sum of all the left nodes and the sum of right nodes in a Binary search tree. I have used BFS to traverse the tree. The code is as follows: ...
Aneesh K's user avatar
  • 333
3 votes
1 answer
1k views

Rust Task Queue

The purpose of this program is to have one thread (main thread) working on I/O reading lines from a file and feeding it to a pool of worker threads whose job is to perform some processing on each line ...
the_endian's user avatar
  • 1,343
3 votes
1 answer
2k views

Are there pitfalls to this solution to read messages from a queue in parallel?

I've posted a question on stackoverflow: How can I consequently read messages from a queue in parallel? I would like my own answer to be reviewed. Situation We have one message queue. We would like to ...
annemartijn's user avatar
3 votes
2 answers
667 views

Shutdown method in queue implementations

I am trying to implement a shutdown method in queue implementation. I took the code from BlockingQueue source from Java and trying to check the shutdown method. Will the following code be thread safe ...
raghuraviram's user avatar
3 votes
2 answers
84 views

Enhancing a non-multithreaded Circular buffer

Looking to get some feedback on a simple non-multithreaded circular buffer. Ideally, I'd want to have a logic to prevent the data from getting overwritten but couldn't find a reasonable way. For ...
xyf's user avatar
  • 508
3 votes
1 answer
390 views

Simple queue on F#

...
Vlad Lutsenko's user avatar
3 votes
1 answer
49 views

Singly-linked queue in PHP 7

I am learning PHP 7 and decided to implement a simple FIFO singly-linked queue in it: ...
coderodde's user avatar
  • 28.7k
3 votes
1 answer
2k views

Non-recursive BFS Maze Solving with Python

I wrote this program to help me understand how BFS and Queues work. (Also DFS if I replace the queue with a stack). It works, but I'm curious how well I implemented the algorithm. Are there any ...
Robin Andrews's user avatar
3 votes
3 answers
220 views

Singly-linked list queue

I recently learned the core .NET Queue type uses arrays internally, and that this is actually much more efficient. I've had a go at writing a singly-linked list ...
Lee's user avatar
  • 183
3 votes
2 answers
1k views

Implementation of a Resizing Array Queue

Below is a problem from Sedgewick's Algorithms and my solution. Any thoughts or suggestions for improvement would be much appreciated. Develop a class that implements the queue abstraction with a ...
albertjorlando's user avatar
3 votes
1 answer
2k views

Work stealing queue

I implemented work stealing queue inspired by Sean Parent's talk on code::dive 2016. Full implementation is here. I am looking to get feedback on improvements to make code more effective and common ...
Viktor's user avatar
  • 143
3 votes
1 answer
2k views

Max-Heap arraylist based priority queue written in Java

I have a program that I'm writing that needs to use a priority queue as part of an algorithm. I specifically need to order (String, Integer) pairs for example (Bread, 3), (Beer, 5), (Eggs,2), etc. I'...
j.jerrod.taylor's user avatar
3 votes
1 answer
387 views

TCP retarder for network delay simulation

I would like to simulate delay over network, for that I have implemented a simple retarder (=introduce random delay while maintaining order of messages) using Boost to handle sending itself. It ...
wondra's user avatar
  • 143
3 votes
1 answer
184 views

Receptive map queue

I've written a class I call ReceptiveMapQueue. Its purpose is to organize the internal structure of an AFKable RPG. It only has two public methods - dumping entries ...
corsiKa's user avatar
  • 660
3 votes
3 answers
3k views

Array-based queue implementation using C

I wrote this header for generic use of a queue. The one thing I'm wondering is if I understood the usage of void*. I hope that if somebody teach me some conventions ...
kidkkr's user avatar
  • 347
3 votes
1 answer
3k views

MazeRunner in Java

To test the queue I perfected from one of my CR questions, I've developed a maze program that receives an input maze, starting and end positions, and solves it. I have separate software that handles ...
T145's user avatar
  • 3,099
3 votes
2 answers
736 views

LinkedList Queue implementation

I'm working on a project which simulates (very simple/watered down) a network. The basis of this is to learn how to implement a Queue. I understand there are many ...
user avatar
3 votes
2 answers
5k views

Displaying items in a circular queue

I am dealing with the following problem: Write a method for the Queue class in the queue.java program (Listing 4.4) that displays the contents of the queue. ...
user2733436's user avatar
3 votes
1 answer
2k views

MemoryCache as a message broker?

I'm in the middle of a project that was built around Microsoft's Message Queue service. During development all of our machines are on a domain and we were able to create a public queue accessible from ...
B2K's user avatar
  • 208
3 votes
1 answer
75 views

Extract equally from X queues to one queue with Y elements

I need to implement a system of queueing that extracts elements equally from x queues to one single queue with y positions. Let'...
tobia.zanarella's user avatar
3 votes
1 answer
22k views

Simple generic multithreaded queue

This is a simple thread safe queue that is used in a producer-consumer model. ...
Odys's user avatar
  • 133
3 votes
1 answer
48 views

A generic queue that transfers data from interrupt to main program

This code aims to implement a queue, which transfers data from interrupt to main program in a bare metal embedded system. There are two execution points, the main program and the irq handler. Both ...
Jackoo's user avatar
  • 31
3 votes
2 answers
404 views

Optimize Leetcode 239. Sliding Window Maximum using Swift

LeetCode problem 239. Sliding Window Maximum You are given an array of integers nums, there is a sliding window of size k which ...
Shawn Frank's user avatar
3 votes
1 answer
827 views

Thread safe reader-writer queue with C++11

Below is my honest attempt to write thread safe queue using C++11 features. Please review it and provide your comments. ...
Anand Shah's user avatar
3 votes
3 answers
5k views

C++ Queue Implementation

so I wrote a queue implementation in c++ and even though I know the code probably isn't as robust as it should be and probably doesn't perform all the checks it should, I'd like to know mostly if ...
Tiberiu Savin's user avatar
3 votes
1 answer
714 views

Queue class with enqueue and dequeue

I am just learning swift and tried to make a queue class with enqueue and dequeue. The node holds the data for each element The enqueue adds an element to the "queue" The dequeue deletes the first ...
Sigils's user avatar
  • 133
3 votes
1 answer
1k views

Making a copy constructor more flexible for ADT queue

I have constructed a copy constructor for an ADT queue. The copy constructor works fine. I would want to improve my code, but I don't really know how to shorten it to make it more flexible. ...
Tinker's user avatar
  • 33
3 votes
1 answer
3k views

Javascript Queue for async functions

Based on the answer to my previous question on Stack Overflow, I put together the following Queue class. I realize there are already libraries out there to do this. However, I wanted to actually ...
Marcus Hughes's user avatar
3 votes
1 answer
670 views

Message queues in Common Lisp

General advice for a change. This is an implementation of message queues that I'm going to use for some work on an actors model library. ...
Inaimathi's user avatar
  • 2,163
3 votes
1 answer
119 views

Merging pages together into an append log

Situation I'm scraping data from a paginated list on a website to be sent out as notifications. For the most part we'll only need to scape the first page and handle additions, deletions and duplicates....
Phroggie's user avatar
3 votes
1 answer
146 views

Constexpr circular queue - follow-up #1

Follow up to my question here: Constexpr circular queue . I've taken the time to fix the many problems pointed out there and am asking for any tips/corrections for the new version below. The queue ...
Steve Zhang's user avatar
3 votes
2 answers
2k views

C++ concurrent queue and testing

I've written concurrent queue based on std::queue. ...
TPlant's user avatar
  • 131
3 votes
1 answer
336 views

MazeRunner in Java - follow-up

I've refined a lot of the code from my previous question, and have also decided to include the logic that interprets a given text file. Any advice on how to improve the actual algorithm that solves ...
T145's user avatar
  • 3,099

1
4
5
6 7 8