82 Topics

Member Avatar for
Member Avatar for superchica08

How to display odd and even numbers from a queue link list? hello everyone i really need some help right now on this program. what this program is supposed to do is copy 11 22 44 77 33 99 66 into a linked list that behaves like a queue. the …

Member Avatar for chaau
0
4K
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 have a discrete event simulator for m/m/1 queue. How can I have a program based on priority queue using M/M/1 model. PLEASE help me to have an idea about priorities and thier implementations

Member Avatar for SAM2012
0
306
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 SAM2012

I need your help regarding the message acknowledgement in the queue when the message reaches at the queue. Any help would be highly appreciated. the code for my queue class is; struct ListNode { ListNode(gcroot<message^> msg); gcroot<message^> msg; ListNode* next; }; ListNode::ListNode(gcroot<message^> msg): msg(msg), next(nullptr) {} public class queue { …

Member Avatar for DeanMSands3
0
185
Member Avatar for MrEARTHSHAcKER

Hi, I am learning queues and I have found 2 examples. Both examples represent queues with limited size, for example 30. But <queue> allows us to create queue that is not limited by ***pre-set** queue size. Can anyone explain me how have they created something like that? Thanks! ***By *pre-set* …

Member Avatar for MrEARTHSHAcKER
0
228
Member Avatar for themenucha

Hi! I'm trying to emplement the job queue. Somehow i can't initialize it: the queue is empty `Inline Code Example Here` //INCLUDES #include <stdio.h> #include <stdlib.h> #include <semaphore.h> #include <pthread.h> //GLOBALS pthread_mutex_t job_queue_mutex = PTHREAD_MUTEX_INITIALIZER; int i; #define N_threads 10 int val=0; //STRUCTURES typedef struct job { int data; struct …

Member Avatar for histrungalot
0
416
Member Avatar for Hypnos_16

[I]This exercise will explore the queue and stack data structure implemented with linked lists. The Koch snowflake can be implemented without recursion by using a queue or a stack. Assume that L is either a queue or a stack, L.add( seg ) adds a segment, and L.remove() removes the segment. …

0
106
Member Avatar for bloominninja

Hi, I'm getting pretty frustrated with my code at this point, Im trying to implement a queue class to hold a number of integers... however dev (the compiler im using) keeps spitting out the errors [CODE] [Linker error] undefined reference to `QueueType<int>::QueueType()' [Linker error] undefined reference to `QueueType<int>::~QueueType()' [/CODE] here …

Member Avatar for bloominninja
0
232
Member Avatar for polarpandabear

Hello Guys, I'm new here and I would like to ask help from you in making circular queue. I'm solving these for days but I can't have any idea anymore to solve for it's algorithm... I made this code so far... [CODE]#include <iostream> #define SIZE 5 using namespace std; int …

Member Avatar for polarpandabear
0
406
Member Avatar for eavila

Hey, so as you can tell, this is my first attempt at writing a class. I put in a mock int main() in order to follow what exactly is going wrong. As far as I can tell, every time the struct in push is used, it always has the same …

Member Avatar for gusano79
0
142
Member Avatar for BoBok2002

I am working on a project and part of the instruction goes like this: "The whole system allows up to 10 processes currently stay in memory, only one of them is running on the CPU, while the others are in either the Ready Queue or blocked in the Disk queue. …

Member Avatar for BoBok2002
0
2K
Member Avatar for taylor0934

I am having trouble starting, I have the default constructor. Just set Head, Tail, Pred and Succ equal to 0. The copy constructor I am having problems with, don't know where to start. [CODE]enum Direction { front_to_back, back_to_front }; template <typename EType> class PQueue { private: struct Node { EType …

0
85
Member Avatar for xxunknown321

[COLOR="Red"]First off let me just say i don't want anyone to do my homework for me. I get a greater sense of satisfaction knowing that I did the work. with that being said I'm looking for some way to start or some input on what measures I should take while …

0
126
Member Avatar for Serafel

My basic problem is that I'm having a hard time implementing a Pthread that consists of a round robin dequeuing 4 arrays consisting of ints. Followed by a Pthread that creates random numbers with which to enqueue them with. I've written most of the code for the queue itself and …

0
219
Member Avatar for machine91

I want to have two threads with a queue exchanging data (in the form of lists) between the two threads. However, at the moment I cannot fathom out how to write the code simply for taking the first list from the queue, processing it(which I have written the function for) …

Member Avatar for Gribouillis
0
248
Member Avatar for CodeAerial

I am making a program the enqueues a number at index 0. I also made a function for it, as written below: [CODE] //main #include <stdio.h> #include <stdlib.h> #include "functions.h" main(){ int *queue = NULL; int size, choice, aNumber, numberOfQueues; do{ printf("Enter Array size: "); size = input(); allocateMemory(&queue, size); …

Member Avatar for nezachem
0
161
Member Avatar for milan2011

Hi everyone, I want to implement an ADT Queue class (pointer base) use Template with following public interfaces: enqueue,dequeue,dequeueAll,peek,and size. I have 2 problems: 1.not sure how to dequeueAll which is removes all elements from the queue with Postcondition: size( ) returns 0 2.for dequeue and peek I need to …

Member Avatar for milan2011
0
975
Member Avatar for annitaz

[CODE]template < class Object> void fix(queueType < Object> &q, int n) { -if (n>=1) -{ ---Object temp = q.front(); ---q.deleteQueue(); ---fix(q,n-1); ---q.addQueue(temp); -} }[/CODE] (a)what will the final state of queue q1 be after the statement fix(q1,2); is exexuted, if q1 has the values (1,2,3,4,5} my answer: {2,3,4,5,1} because q.addQueue …

Member Avatar for annitaz
0
195
Member Avatar for c0ld sn1ff3r

Hi, I need to develop a C# console application which implements stack as a circular queue. I've written the code to use stack as a simple queue. [CODE]using System; public class Stack { private int[] theArray; private int topOfStack; public Stack() { theArray = new int[10]; topOfStack = -1; } …

Member Avatar for ddanbe
0
755
Member Avatar for ayat taj

[COLOR="Green"][I]CAN YOU HELP ME TO SOLVE THIS Assignment.... PLEASE....[/I][/COLOR] [COLOR="red"][B][U]THIS IS THE QUESTION : [/U][/B][/COLOR]Implement the linkedPriorityQueue class as defined below. Note the following:  Each node in linkedPriorityQueue represents a customer. A customer can be regular or with a high priority. High-priority customers have their high_priority variable set to …

Member Avatar for Fbody
0
209
Member Avatar for deviliq

hi there [B]how do i determine the average Number of Queue Items that leave the queue (example: processes leaving the ready queue in order to be Running in the CPU) per second?[/B] i need this value to calculate for the average waiting time. the formula is: w = n/X where …

Member Avatar for deviliq
0
1K
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 rockerjhr

globals.h [CODE] #ifndef _globals #define _globals #define NEXT(L) ( (L) -> next ) #define DATA(T) ( (T) -> datapointer ) #define LEFT(T) ( (T) -> left ) #define RIGHT(T) ( (T) -> right ) typedef enum { OK, ERROR } status ; typedef enum { FALSE=0 , TRUE=1 } bool …

Member Avatar for WaltP
0
180
Member Avatar for John Linux

I am using a) Linux b) Pthreads I want to write a program, with two pthreads, to cater for two queues of people. People arrive at each queue at a random interval of 1 - 10 seconds. Each time a person arrives, print out the number of people in each …

Member Avatar for John Linux
0
178
Member Avatar for Mabyboi

So im working through this and im having troubles finishing it off. Essentially im reading a text file, and tokenizing the numbers in the file, but what needs to be done is for each line in the file to be store in its own Queue, and then the Queue's need …

Member Avatar for Taywin
0
1K
Member Avatar for soUPERMan

Hello, I wanna write a method that recieves an argument of type String which is a mathematical expression in infix mode, then change it to postfix and store in a queue and return the queue...how do i go about that?? I have created so far a Queue class, Node class.

Member Avatar for lucky_Username
0
947

The End.