A queue is an ordered, first-in-first-out data structure. Typical implementations of queues support pushing elements to the back and popping them off the front position.
4
votes
2answers
79 views
Implement queue using linkedlist
Implement queue using linkedlist. Looking for code review, optimizations and best practices.
...
3
votes
2answers
43 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
313 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:
...
0
votes
0answers
35 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. ...
2
votes
0answers
40 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: ...
3
votes
0answers
84 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
86 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
499 views
Circular queue implementation
Implemented simple thread safe circular queue. Looking for code review, optimizations and best practices.
...
3
votes
1answer
64 views
Lock-free queue with doubly linked list correctness
I need a lock-free queue which is implemented by doubly linked list.
Is my code correct? Are there any errors? Are there any improvements to be made?
linkedlist.h
...
3
votes
2answers
71 views
Thread-safe queue
I need a thread-safe C++ queue. This is what I have in my project, which is mostly based on code I've found on Stack Overflow. How good is it? Can you make it better? Can you suggest better ...
4
votes
2answers
142 views
Worker AI and Job Queue Management for Simulation Game
So I've been working on AI for a Tower Building simulation game for quite a few days, and I think the code would really benefit from review. I'm a hobbyist programmer, but I really care about doing ...
5
votes
1answer
113 views
Managing People in a SimCity Clone
So I am working through a few different game ideas as I learn programming, and I could definitely use some feedback on my latest project. This is a simple SimCity clone. So far I have created a City ...
2
votes
1answer
59 views
Job queue that performs actions
A brief background:
I'm working on a game prototype for a simple strategy game. After I created a number of possible jobs I wanted to create something to manage them. This is the first time I've ...
7
votes
1answer
168 views
Lockless Queue Multiple-Reader Singler-Writer in C++
I wrote a lockless queue for sending small objects from a single thread to a random worker thread.
Assumptions:
x86/x86_64 compiled with GCC
one thread may Write(), multiple threads may Read()
...
3
votes
1answer
122 views
Big-O complexity calculation for a merge and sort function
I have the following code which basically takes a list of sorted integer arrays and merges them together removing the duplicates.
I have tried to do the complexity analysis and came to a rough ...
9
votes
3answers
477 views
Tail implementation in C
Write the program tail, which prints the last n lines of its input. By default, n is 10, ...
3
votes
0answers
52 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 ...
11
votes
1answer
2k views
Thread-safe concurrent FIFO queue in C++
Is this the correct way to implement a thread-safe concurrent FIFO queue in C++? It requires passing unsigned char* arrays of binary data.
Thread Safe Concurrent ...
5
votes
1answer
134 views
Optimization for add function in queue
I would prefer if more experienced users could give pointers on how I can optimize and think better when writing code.
Using Homework Questions as reference, as this is a homework related question. ...
7
votes
1answer
504 views
Continuously receive messages async from Azure Service Bus Queues
I'd like to get input on my approach of continuously receiving messages from an Azure Service Bus queue using the async part of the library.
My main concern being whether its "safe" to use ...
10
votes
2answers
2k views
First-come first-serve job scheduling algorithm
I tried to make the code for implementation of first-come first-serve job scheduling algorithm as used by operating systems.
How can I make it better?
I am using turbo C++ compiler
...
3
votes
1answer
128 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 ...
7
votes
2answers
980 views
Multi producer/consumer queue (without Boost) in C++11
Not lock-free, but still only C++11 and no Boost. It also supports timeouts.
Edit: Here is an updated version after the reviews (use wait_until() with a predicate ...
2
votes
3answers
2k 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 ...
5
votes
1answer
118 views
Very simple priority queue
I wrote this code to handle a fixed number of priority levels. I believe performance will depend on the number of priority levels.
Considering only a few levels (3 to 5), is there a more efficient ...
5
votes
2answers
295 views
Queue implementation in C
I was reading about opaque pointers and decided to try it with queues. Please review my code and let me know if there are any errors and how to improve code quality and performance.
It uses lines to ...
2
votes
4answers
313 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 ...
1
vote
1answer
47 views
FixedSizePriorityQueue - Review Request
I implemented the FixedSizePriorityQueue class. The intended purpose is that, you can add as many elements as you want, but it will store only the greatest ...
1
vote
1answer
105 views
4
votes
2answers
346 views
Implement data structure overflow queue
Implement data structure overflow queue. Overflow queue is a normal queue with one extra property. It never throw Stack overflow exception. So whenever queue becomes full, it replaces the oldest ...
1
vote
1answer
322 views
Removing nodes from queue
I had an exercise to create two methods for simple queue class, first to delete last element and second to delete element at k position. Particularly I'm not asking for better implementation. Is it ...
2
votes
2answers
421 views
Fixed size priority queue
I've tried implementing priority queue with fixed size in Java using TreeSet and overriding add() method:
...
1
vote
0answers
730 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 ...
2
votes
2answers
1k views
Thread safe message queue without mutex in C
I'm trying to write a message queue implementation
so my threads can exchange data.
To keep things simple, the queue is only responsible for
sending pointers to memory. Only one thread may send ...
4
votes
1answer
297 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:
...
5
votes
1answer
170 views
Reducing memory footprint with queue of classes
I hope I've asked this in the right area. I'm writing a program that deals with enqueueing a class on STL queue in C++. Initially it queues initializations of the ...
2
votes
1answer
199 views
What is this structure called?
I've been writing this data structure for a few days, and now I'm really curious about what it actually is, and to get some critique on my logic.
A branch, based on this usage, exists when a ...
1
vote
0answers
35 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's say I have 5 queues, each with a number of elements and I need to ...
1
vote
2answers
3k views
Static class ThreadPool implementation
The following code is a self-implementation of the static class ThreadPool in C#, only the QueueUserWorkItem (the simpler ...
2
votes
2answers
339 views
Optimize BFS weighted search in python
I have a weighted BFS search in python for networkx that I want to optimize:
...
1
vote
1answer
843 views
Queue implementation Doubly Linked List [closed]
Here is my implementation for a queue using doubly linked list:
...
6
votes
1answer
220 views
BFS for creating a queue without repetitions and with loops in the graph
I have a pipeline with loops of filters and one input filter. The rest are splitters, transform and output.
I would like my code to go over the filters and push them into a queue (order is ...
7
votes
1answer
145 views
STL-style deque class
I decided to write an STL-style class as an exercise. I followed a tutorial of sorts that I found online, but I also made some modifications. I'd like to hear any criticisms you folks might have. Be ...
5
votes
4answers
2k views
Optimizing a thread safe Java NIO / Serialization / FIFO Queue
I've written a thread safe, persistent FIFO for Serializable items. The reason for reinventing the wheel is that we simply can't afford any third party dependencies ...
6
votes
1answer
316 views
A queue that switches from FIFO mode to priority mode
I implemented a queue capable of operating both in the FIFO mode and in the priority mode: when the priority mode is enabled, the elements are taken in order of decreasing priority; when the priority ...
4
votes
2answers
473 views
Binary tree max sum level - better design?
I have written some code for finding a level in a binary tree, having a maximum number of elements. I have a few questions:
Is it a good design? I have used 2 queues but the total sum of elements ...
2
votes
1answer
163 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.
...
3
votes
2answers
1k views
Robust logging solution to file on disk from multiple threads on serverside code
I have implemented a socket listener that runs on my Linux Ubuntu server accepting connections and then starting up a new thread to listen on those connections (classic socket listener approach). ...
1
vote
1answer
4k views
Simple generic multithreaded queue
This is a simple thread safe queue that is used in a producer-consumer model.
...
4
votes
2answers
3k views
Did I need to use lock to ensure that Queue.Dequeue is Thread Safe in this case on .NET 2.0?
Is this ok? I am using C# and .NET 2.0
I have this Queue declared in my class :
...