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.

learn more… | top users | synonyms

4
votes
2answers
91 views

Thread-safe lock free FIFO queue

A few years ago there was a need to add a FIFO queue between 2 threads into my project. At that time I've got some interesting idea how to do that without any atomics and locks. (There was a ...
-3
votes
1answer
65 views

Simple Implementation of a BlockingQueue

An implementation of BlockingQueue ...
1
vote
1answer
23 views

ADTQueue with circular doubly linked list

I have written these codes and in trying out the code in my main method, it looks like I am on the right way, but which disturbs me is the fact, that whenever I say: ...
8
votes
5answers
245 views

RingQueue implementation using std::array

I've recently finished implementing a ring queue based on std::array in C++11. I tried to write the code as if I were going to submit it to the C++ Standard ...
-3
votes
1answer
70 views

Verify FIFO dequeue algorithm

I have a FIFO queue of packets, which maintains: Push index Pop index Count I would like to assert my dequeuing algorithm: ...
5
votes
4answers
217 views

Implementation of C linked list (Queue) of C strings on mega AVR

I have been working on a mechanism to queue up strings coming into a system via a USART and have implemented it as a singly linked list. I have done my best to profile the code and its memory usage at ...
4
votes
1answer
47 views

Serializable Queue header only library

I was hoping someone could check the library I 'm working on to see if they could give any suggestions. My biggest issue right now is getting tuple to work with more than just the basic types and I ...
2
votes
1answer
88 views

Priority blocking queue implementation

This is a follow on question from one I asked a few days ago here: Single process blocking queue Using the comments I determined that there probably isn't a pre-built solution for this and so I have ...
7
votes
1answer
222 views

Calculate the running median

I'm trying to solve a challenge where you need to calculate the median every time you add a number. say you have a list of numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ...
3
votes
1answer
69 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. ...
6
votes
1answer
101 views

Lock-free, multiple consumer, multiple producer queue

I'm implementing a lock-free, multiple consumer, multiple producer FIFO queue/pipe as an exercise in thinking about atomicity in operations. My main concern is correctness of operation, my second ...
4
votes
1answer
147 views

Lockless multi user, multi consumer FIFO queue using C++11

One of the features that is missing from C++11 are lockless queues. Therefore I have decided to write one myself. A few remarks: I know the code isn't technically lockless. However the lock is only ...
5
votes
1answer
71 views

MailQueue - follow up

Follow up of this question. Things altered: Put logging (debug level) for creating and starting thread. A separate thread for starting the different threads. Locking object and synchronise for ...
5
votes
2answers
117 views

MailQueue implementation with auto start - stop

Previous question was a little portion of the mailQueue. I finished the MailQueue, which has the ability to start and stop ...
6
votes
2answers
85 views

Templated queue implementation

I wrote an implementation for a simple queue in C++ (for practice, since there's an stl queue). I've been trying to focus on memory management and the rule of three. Any suggestions/improvements? ...
2
votes
2answers
79 views

ConcurrentLinkedQueue to unmodifiable list

I have a ConcurrentLinkedQueue where I put some mails in. Now I have a visual page where I want to see what's in the Queue, but ...
3
votes
2answers
82 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 ...
2
votes
1answer
223 views

Priority Queue Linked List Implementation

I am new to Python and wanted to make sure my code answers the question for my assignment due. My Task: A priority queue is a queue in which each item is assigned a priority and items with a ...
2
votes
1answer
79 views

Fixed size double-ended queue

I require hundreds of equal, small sized buffers in my current project. The bulk of the computation in the program operates on data stored directly in those containers, so high performance is ...
2
votes
0answers
28 views

Functional, Loaner-Like Pattern For Consuming SQS Queues, Deleting Queue Items On Success

My program fetches input from a RabbitMQ or Amazaon SQS-like queue. There is not always input available in the queue. If a message is available, it triggers work. If that work is successful, ...
1
vote
0answers
174 views

Simple Priority Queue

I am trying to implement A* search on a grid in MATLAB. I am currently using a priority queue class I found here, but it's a bit slow. I tried to write this simple priority queue class in MATLAB: ...
2
votes
1answer
64 views

Asynchronously load and unload a queue

This code is supposed to asynchronously load a queue from a generating function. ...
2
votes
1answer
458 views

Array-based FIFO queue in C

I have this "generic" implementation of an array-based FIFO-queue. As I have written very little code in C, I don't have an idea what to ask, so feel free to tell anything that comes to mind. ...
3
votes
1answer
436 views

Printing a tree level by level

I have written a program to print a binary tree level by level on different lines, like the tree would actually look if drawn on paper. I have done a BFS traversal and then I proceed to print the ...
3
votes
1answer
131 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: ...
0
votes
1answer
96 views

Queue like system to check existence of email

I have a table in my database containing email and email_state amongst other values. Email is the email of the contact, and ...
0
votes
0answers
30 views

Reload pickled objects into dict - assigned to variable name from file name

I'm doing a bunch of work with echonest audio objects (as returned by the echonest API) in the Python CLI and rather than having to recreate them each time, they can be saved. This bit of code ...
3
votes
2answers
235 views

Immutable Queue in Java using an Immutable Stack

I am new to this Immutability concept and I have some coding experience in JAVA. Recently as a part of internship program, they gave me a 5-day task, which was to implement Immutable Queue. After some ...
2
votes
1answer
186 views

Circular Queue using Linked List

I want to create a circular queue using a linked list. I also want to create many instances of that data structure (queue) without repeating the code. This is what I came up with: ...
2
votes
1answer
365 views

Binomial heap in Java

I have this implementation of a binomial heap providing insert, decrease-key and extract in logarithmic time. MinPriorityQueue.java: ...
3
votes
1answer
165 views

Circular queue implementation using two regions

Inspired by the "bip buffer", I coded a fixed-size circular queue that uses two regions (two pairs of begin/end pointers) to account for the wrap-around. The main goal of this design was to simplify ...
7
votes
5answers
883 views

Simple server to manipulate priority queues

In a few months I'll work on a C++ project that could span a year or two. I've a strong C background and for the usual reasons I always chose C over C++ (please forgive me). To extend my capabilities ...
3
votes
1answer
314 views

Queue with std::vector

How can I improve this code? ...
2
votes
1answer
131 views

Implementing a simple queue in C

I am learning C and I have some trouble with pointers. I decided to create a queue to practice a bit. The program works as intended, however I want to know some good practices and suggestions. Here ...
4
votes
1answer
9k views

Shortest path Dijkstra's algorithm

I'm trying to implement Dijkstra's algorithm to find the shortest path from a starting node to the last node of a 250px by 200px raw image file (e.g. starting node = [0][0], ending node = [250][200]). ...
2
votes
2answers
157 views

Using a Java queue

I am developing a plugin for a system, the plugin catches some events in that system, wraps them and pushes out to another system for analysis. The overhead generated by the plugin must be as low as ...
5
votes
2answers
1k views

Queue implementation without using built-in data structures

In an effort to brush up my algorithms and data structure skills I have a done a queue implementation without using built in data structures, i.e. using only arrays. Any comments on this code ...
2
votes
2answers
198 views

Multithreaded lock-free queue implementation

My partner and I are beginning to believe there could be a desync possibility in the lock free queue we have written, but we would like some fresh eyes on the subject. What are your thoughts on our ...
1
vote
0answers
101 views

Multithreaded queue manager

I've written a simple multithreaded queue manager in JavaScript which will be seeing some pretty heavy usage at a later point in the project I'm working on. I think it's pretty solid, but I wouldn't ...
4
votes
2answers
175 views

A queue with access to the last element

Following this question, I realized there is no built-in data structure like that, so I implement my own queue using List<T>. Please comment on performance ...
1
vote
2answers
1k views

Queue with task parallel library

I am new to programming using the .Net TPL Framework and multi-threading in general. I have googled up some tutorials and articles and put together the solution below. It is a simple multithreaded ...
4
votes
5answers
1k views

Is this queue properly implemented?

I tried to implement a queue which stores it's elements in a resizing array. Seems to work fine. Can you tell me if i did something wrong? ...
4
votes
1answer
86 views

Threading and queue experiment

I'm just beginning to get the idea of queue and threading. I would welcome input on this exercise script: ...
5
votes
4answers
5k views

Array Implementation of Queue

I've implemented the queue data structures using array in java. Anything I need to change in my code? Queue.java ...
15
votes
2answers
195 views

Interprocess Communication in a Farmer-Worker setup

The following code is my first C program I have made for an university assignment about Interprocess Communication. This involved creating a parent process, the farmer, and then creating a certain ...
6
votes
1answer
15k views

Queue Implementation using a Linked List

For understanding the concepts, I've implemented the Queue data structures using a linked list. Is there anything to improve? LinkList.java ...
11
votes
2answers
270 views

Espresso Queue simulation

I was asked to do a technical test with the following specification, but my solution was rejected and I was not selected for the available position (Junior to "normal" level, with 4 days of time to ...
2
votes
2answers
272 views
7
votes
3answers
4k views

STL queue implementation

I've implemented a simple C++ STL like queue. (I've tried to follow @LokiAstari stack implementation code fashion) ...
4
votes
4answers
980 views

LinkedList to be used in a stack or queue

This all works. Just wanted to make sure I didn't miss anything. Coming from C++ and working my way through Algorithms, 4th ed. Here is my LinkedList class: ...