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

2
votes
1answer
37 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. ...
0
votes
0answers
15 views

Working with C++'s Queues [closed]

So, to teach myself how to work with queues in C++, I started out simple. All I want to do is find the greatest value contained within a queue of integers. When I did this: ...
3
votes
1answer
52 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
45 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
54 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
18 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
79 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
61 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
110 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
88 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
798 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
76 views

Queue with std::vector

How can I improve this code? ...
2
votes
1answer
84 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 ...
3
votes
1answer
1k 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
123 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
424 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
142 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 ...
0
votes
0answers
52 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
85 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
428 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
846 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
59 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: ...
4
votes
4answers
758 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
186 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 ...
5
votes
1answer
5k 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 ...
7
votes
2answers
168 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
123 views
7
votes
3answers
2k 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
507 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: ...
2
votes
1answer
150 views

Optimizing implementation of Dijkstra

I am using a std::priority_queue to implement Dijkstra's algorithm: ...
3
votes
2answers
322 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. ...
14
votes
3answers
429 views

Testing a lock-free job queue

I've created a lock-free job queue and with the tests I've written, which is also very fast. That makes me doubt my benchmark procedure, so I'm hoping the collective knowledge will shed some light on ...
0
votes
1answer
109 views

Command line multipart or single file downloader

I am looking for a code review for this multipart or single file chunk downloader using threading and queues. downloader.py ...
5
votes
4answers
1k views

Stack implementation using only one queue in C

We start with an empty queue. For the push operation we simply insert the value to be pushed into the queue. The pop operation needs some manipulation. When we need to pop from the stack (simulated ...
5
votes
2answers
91 views

Revised Job Queue for Strategy Game

After posting my previous question about this Job Queue, I decided I wasn't actually very happy with it. I am embarrassed to admit that upon further testing it did not function properly in all ...
10
votes
3answers
2k views

Generic deque implementation

I implemented a generic Deque<T> data structure. Please, review this implementation. Deque.java: ...
5
votes
2answers
822 views

Queue over resizable array implementation

I study data structures on coursera's course, and there is an extra exercise to create a Queue data structure. I created it: ...
3
votes
3answers
81 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 ...
5
votes
3answers
121 views

Job Queue for Strategy Game

I've posted a revised version of this here. I posted about this basic problem a while ago, and I got the recommendation to move the code for managing the Jobs of my game to another class. I have ...
2
votes
4answers
262 views

Maximum of all subarrays of size k

Given an array and an integer k, find the maximum for each and every contiguous subarray of size k. Examples: Input: ...
2
votes
2answers
114 views

Decide the start of the circular gas station path

Suppose there is a circle. There are n petrol pumps on that circle. You are given two sets of data. The amount of petrol that petrol pump will give. Distance from that petrol pump to the ...
5
votes
2answers
185 views

Find max-number div by three to be formed by array elements

Given an array of non-negative integers, find the largest multiple of 3 that can be formed from array elements. For example, if the input array is {8, 1, 9}, the output should be "9 8 1", and ...
4
votes
2answers
2k views

Implement queue using linkedlist

Implement queue using linkedlist. Looking for code review, optimizations and best practices. ...
3
votes
2answers
440 views

Class that implements a queue using two stacks

I am looking for a review of my code that implements a MyQueue class which implements a queue using two stacks. ...
4
votes
1answer
350 views

Queued Employees

The following example shows how to implement a queue in an employee structure. I am looking for a review of the implementation: ...
1
vote
0answers
145 views

WebApi synchronize database (EF 6) access

I'm working on an ASP.Net MVC 5 /WebApi 2 project. I'm using EF 6 code first for my database access. I've a WebApi action method in which I've to update some data in my database based on the request. ...
10
votes
2answers
258 views

Twitter Streaming Client - Round#2

This is round #2. The initial code review is: Twitter Streaming API Client: Identifying the top trending hashtags for a specific term For a list of changes since the last review, please see this. ...
5
votes
1answer
184 views

Concurrent queue

I recently wrote a concurrent, mutex-less (but not lockfree) queue and wanted to know if it is actually correct, and if there are any particular improvements I could make: ...
0
votes
2answers
134 views

Stack implementation using a queue

I've implemented a stack using a queue. Time complexity: \$O(n)\$ - push(), where n is the number of elements in the queue \$O(1)\$ - ...
4
votes
5answers
4k views

Circular queue implementation

I've implemented a simple thread-safe circular queue. I'm looking for code review, optimizations and best practices. ...