20 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for Builder_1

Simulate a patient’s lines using queues with enqueue ( ), dequeue ( ) and printQueue ( ) operations. Define a queue node in the following manner: typedef struct queueNode { int patientID; // Unique identifier; starts at 1; after 24 hours should be reset to 1 int checkupTime; // Random …

Member Avatar for Builder_1
0
375
Member Avatar for phony

// This program uses the a queue template to create a queue of strings. #include <iomanip> #include <iostream> #include <cstdlib> using namespace std; // // TO CREATE A "template" class named "T" template <class T> // // TO CREATE A CLASS NAMED "Dynque" class Dynque { private: struct QueueNode { …

Member Avatar for phony
0
291
Member Avatar for murali2489

Hi Team, Im reading Collections. It is mentioned that while intialising priority queue, it uses natural ordering by default. But my output is not like that. Below is my code and output. public class BackedCollections { public static void main(String[] args) { PriorityQueue<Integer> pq = new PriorityQueue<Integer>(); pq.offer(3); pq.offer(1); pq.offer(5); …

Member Avatar for murali2489
0
3K
Member Avatar for ktsangop

Hi everyone, I am a C/C++ winapi developer and have to rewrite a "Dialog based" application in java, so that it will execute as an applet in any browser. My java skills are very few, since my knowledge is limited to past college classes. The application is not a large …

Member Avatar for ktsangop
0
371
Member Avatar for crownedzero

I see this example frequently and thought I'd give it a shot but I've got something unexpected happening with my Queue. I have multiple threads utilizing my producer class but the output doesn't show that it is being written to by each thread. protected Queue<ProductMessage> prodQueue = new ConcurrentLinkedQueue<>(); @Override …

Member Avatar for ~s.o.s~
0
273
Member Avatar for FUTURECompEng

public void Enqueue(int value){ node end = endList.next; end.next=null; endList.data=value; endList.next=end; endList=end; Here is my code for an Enqueue method but when I run it mylist.Enqueue(12); It gives me an error. Is something wrong with my method or am I testing it incorrectly? Thanks.

Member Avatar for FUTURECompEng
0
293
Member Avatar for anisha.silva

Hi, I an reading a txt file line by line and putting it in to a Queue<string> q = new Queue<string>(); when i execute the program I get a Argument Exception 'Source array was not long enough. Check srcIndex and length, and the array's lower bounds.' how do i handle …

Member Avatar for anisha.silva
0
1K
Member Avatar for anisha.silva

so i have 4 list of words. what i want to do is for each list go through it and count the number of occurance the word has in the list and print the first 10. when it comes to saving the word and the number of occurance, how do …

Member Avatar for anisha.silva
0
229
Member Avatar for SAM2012

Hi, I need help in designing a function that would model the arrival of the messages in the queue following poisson distribution. I shall be grateful for this kind help.

Member Avatar for SAM2012
0
178
Member Avatar for MrEARTHSHAcKER

Hi, There is short explanation of queue at cplusplus.com site which tells that queue should contain front() and back() functions. As I have tested in VC++, if I use queue from <queue> and call any of these functions for an empty queue, program crashes. Could this problem be solved by …

Member Avatar for MrEARTHSHAcKER
0
2K
Member Avatar for rajesh1158

In the below code, I want to know the significance of 10 while creating a PrioriyQueue. I know its the initial capacity but what does it mean?? I replace 10 with any positive number and the output remains same. import java.util.*; class Test { static class PQsort implements Comparator<Integer> { …

Member Avatar for JamesCherrill
0
198
Member Avatar for Kanoisa

Hi all, I'm currently thinking about how to make a thread safe queue. Specified as such: [LIST] [*]Single reader [*]Multiple writers [*]Dynamically sized [*]Suitable for both a reader sleeping on a queue or as a polled queue [/LIST] So what I'm looking at so far (pseudo)code wise is the following …

Member Avatar for Kanoisa
0
630
Member Avatar for miku003

I'm trying to make an array-based queue that inserts and removes the elements... The default array is {0,0,0,9,10}. after the 0's are filled up it should say that its Full and will return to the loop. I'm having trouble making 3 particular methods which is dequeue, isEmpty, and isFull.. [CODE]class …

Member Avatar for miku003
0
173
Member Avatar for gutchi

Hi Everyone! I have here a queue: [CODE]my $qTool = Thread::Queue->new();[/CODE] I want to show all the elements that the queue contains. [CODE]my $qItem = $qTool->peek();[/CODE] The code above returns only either the head of the queue or an element at a specified index. Is there a way for me …

Member Avatar for d5e5
0
231
Member Avatar for ace8957

Hi all, I've been working on making a bounded priority queue implemented as an array of queues and I believe I have it at last -- except of course for this error that I don't understand... I am getting an error about the queue array being declared without a type …

Member Avatar for ace8957
0
409
Member Avatar for ace8957

Hello all, So I'm working on this simple program with a Queue class template that is publicly derived from the abstract base class CharQueue. The only problem is that I keep getting hit with the error "expected class name before '{' token". The reason I don't understand this is that …

Member Avatar for Fbody
0
716
Member Avatar for crossbow25

SinglyList.h [CODE] #ifndef SINGLYLIST_H #define SINGLYLIST_H #include <iostream> #include <string> using namespace std; class Exception { private: string errMsg; public: Exception(const string& err) { errMsg = err; } }; class InvalidPositionException : public Exception { public: InvalidPositionException(const string& err) : Exception(err){} }; class EmptyException : public Exception { public: EmptyException(const …

Member Avatar for crossbow25
0
249
Member Avatar for coolboym99

I'm writing up a program for a class I'm taking where I need to make a linked list stack & queue. Right now I'm not quite done, but I'm having problems calling the functions from the .h file. What's happening is in the while loop, I'm trying to get data …

Member Avatar for coolboym99
0
199
Member Avatar for faby

hello everyone! I wanted to create a priority queue in which there would be different dictionaries with their priority numbers. The major problem I'm experiencing is that the queue just prints the dictionaries without regard for their priority. Please what do I have to do so that the queue prints …

Member Avatar for TrustyTony
0
2K
Member Avatar for metdos

Hello Everyone, I'm trying to implement a Polymorphic Queue. Here is my trial: [CODE]QQueue <Request *> requests; while(...) { QString line = QString::fromUtf8(client->readLine()).trimmed(); if(...)){ Request *request=new Request(); request->tcpMessage=line.toUtf8(); request->decodeFromTcpMessage(); //this initialize variables in request using tcpMessage if(request->requestType==REQUEST_LOGIN){ LoginRequest loginRequest; request=&loginRequest; request->tcpMessage=line.toUtf8(); request->decodeFromTcpMessage(); requests.enqueue(request); } //Here pointers in "requests" do not …

Member Avatar for metdos
0
282

The End.