Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
53 views

I am learning about queue data structure in python. I learnt the implementation of a queue using list in python and the issue of memory wastage when we dequeue a few elements from the front. We use a ...
dataminer's user avatar
0 votes
1 answer
80 views

I use two mutexes for enqueueTS() and dequeueTS(), so that writer and reader threads can run simultaneously without waiting for each other. However, both enqueueTS() and dequeueTS() can affect member ...
Anderson Chris's user avatar
1 vote
0 answers
106 views

I have implemented a circular queue using an array in C++. The queue uses two atomic variables, front and rear, to manage enqueue and dequeue operations. When an element is enqueued, rear is ...
Revanth Thota's user avatar
2 votes
1 answer
479 views

I have to implement a queue using a circular array and am having difficulty. This is what should happen: The enqueue() function returns a bool value: true if the queue is non-full prior to enqueuing ...
akap04's user avatar
  • 21
0 votes
1 answer
102 views

In the 2.2.2 sequential allocation section, TAOCP volume 1 , Donald Knuth mentions that F = R = 0 is for the two cases (4) and (5) of the circular queue, but if we use (6a) and (7a), we should set F =...
da_miao_zi's user avatar
1 vote
1 answer
121 views

I'm working on a C program that implements a queue, and I'm encountering an issue with an infinite loop. The program is supposed to perform insertion, traversal, and deletion operations on the queue. ...
Partha 's user avatar
1 vote
1 answer
96 views

LinkSort.adb file with Ada.Text_IO; use Ada.Text_IO; procedure LinkSort is type JobType is (Accountant, Analysist, Manager, Manufacturing, Programmer, Inventory, Sales, SoftwareEnginner); ...
juggernaut45's user avatar
0 votes
0 answers
72 views

In fact, this is not a main problem, I encountered this issue while doing practice about BST traversal with circular-queue. I tried to define inorder traversal recursively and so enqueue-ing data also ...
bFur4list's user avatar
  • 133
-1 votes
1 answer
41 views

/* Queue structure which holds all necessary data */ typedef struct queue { int head; int tail; void** vals; int len; int count; } queue_t; /* creates a new queue with a given ...
Jakub Novák's user avatar
1 vote
0 answers
186 views

This is a function for doubling the circular queue capacity in C (https://i.sstatic.net/xxhah.jpg) Code source : Fundamentals of data structures in C #include <stdio.h> #include <stdlib.h> ...
Yoga Simha Vykuntam's user avatar
0 votes
0 answers
322 views

So I have to implement a circular queue using array and I've used the following code to do so. However, for some reason when I try to add the 5th element to my queue, it does not seem to work. ALso, ...
thetacodude's user avatar
0 votes
0 answers
99 views

Circular Queue in C Currently working on a code that gives us an integer value (1,2,3) along side with a datatype either integer/char/string. Here, 1 -> Enqueue 2 -> Dequeue 3 -> Display For ...
Ayush Soam's user avatar
0 votes
1 answer
190 views

front and rear pointers of circular queue are exceeding the size of array which can be seen in the print statement the input given for size was 3 where pointers go till the value 4 and 6.It would be ...
SWAPNIL SRIVASTAVA's user avatar
0 votes
1 answer
544 views

I was going through a book on Data Structures and Algorithm with JavaScript when I found this piece of codes. I need someone to help me explain the logic behind the code here, also the logic behind ...
Prince Chisomaga's user avatar
0 votes
0 answers
356 views

So, i tried to delete a particular element in a circular queue, and used its index as front and back. When I ran the code: #include<stdio.h> #include<conio.h> #include<stdlib.h> #...
Pratik Choudhuri's user avatar
0 votes
1 answer
82 views

struct PCB { int PID; int burstTime; int arrivalTime; int priorityScore; int startTime; int finishTime; }; struct Queue { int front; int rear; int length; // ...
Sabyasachi Sarkar's user avatar
0 votes
1 answer
177 views

I'm learning Data Structures as required of me by my university. I've implemented the Queue DS using Dynamic Array but it somehow doesn't work. It updates the value on the first enqueue method call ...
Dayyan Ali's user avatar
1 vote
1 answer
241 views

I'm having some difficulty with fully implementing my Circular Array Queue with Java. Specifically, my enqueue is failing to queue the very last value inputted in my queue. I've tested dequeuing and ...
ihill's user avatar
  • 23
0 votes
0 answers
94 views

I am learning circular queue and I am facing some error. While displaying the queue it only shows the first and last element, after deleting an element it gets even worse, now I don't know where ...
Vansh Purohit's user avatar
0 votes
1 answer
481 views

I need to make a program that can keep track of dequeued elements. I was thinking of using three instances of the CircularQueue class, one for all customers as they arrive at the my shop, another two ...
kratos00's user avatar
0 votes
1 answer
292 views

I am trying to solve a leetcode question using list: Design Circular Queue. But it throws an error: IndexError: list assignment index out of range self.queue[self.tail] = value My code: class ...
yinqi's user avatar
  • 41
1 vote
0 answers
95 views

I have a Circular Queue I've made using PHP with all of the generic functions you'd see like dequeue, enqueue, peek etc in a file queue.php I am trying to submit form data using AJAX that has been pre-...
rxm's user avatar
  • 81
0 votes
1 answer
47 views

I'm trying to start to use AJAX to send a Javascript variable from one PHP file to another that will enqueue it to a queue function I have created and then peek that ID in the queue by changing the &...
rxm's user avatar
  • 81
0 votes
1 answer
86 views

I'm trying to create a circular queue and come across this problem. As you see, my answer is incorrect. I still don't understand the reason why it is the case, so let's go through everything again. ...
Hung Vu's user avatar
  • 633
0 votes
1 answer
47 views

I am currently studying circular cues. I came across these functions while studying using the textbook. int NextPosIdx(int pos) { if (pos == QUE_LEN -1) return 0; else return ...
bombo's user avatar
  • 49
0 votes
3 answers
9k views

I'm studying about circular queue in data structure . As you can see from the code below, I try to delete a specific data and insert data on Circular queue. However, when I try to run it there's a ...
Max P Apth's user avatar
0 votes
2 answers
98 views

This is my code int front=-1, rear=-1, CQUEUE[MAX]; int isFull() { if((rear=MAX-1 && front==0) || front==rear+1) return 1; else return 0; } void ...
Sathvik K S's user avatar
1 vote
2 answers
458 views

I'm making simple patient managing program using circular queue but q.rear always have "0" value while executing exit_hos() I thought that addq() makes variable "rear" different, ...
crakel's user avatar
  • 11
0 votes
1 answer
1k views

I have designed a circular priority queue. But it took me a while because it is so conditional and has a bit much of a time complexity. I implemented it using a list. But I need a more efficient ...
Clarke's user avatar
  • 305
0 votes
1 answer
248 views

This is what i have, but i am not sure that this works. I am not sure if copying this way is efficient,and i couldn't figure a way to overload. when copying, i am giving both the same size, setting ...
Nadeem Zeaiter's user avatar
0 votes
1 answer
451 views

I have less than 3 months experience coding, so I've started using LeetCode to just build hours working with code beyond what's assigned in school. I was working on trying to build a circular queue (...
OptimumSlinky's user avatar
0 votes
0 answers
98 views

Most of the programs that I saw produced the results in a linear manner , like displaying a normal one-dimensional array. But here I have a circular queue, and the elements in it must be displayed ...
Ajay Kumar Prasad's user avatar
0 votes
1 answer
140 views

when I call my toString() method it doesn't work if after the index wraps around (front > rear). I have included the code below. After, I enqueue(5) and enqueue(6), the toString seems to be completely ...
focusedchi's user avatar
-1 votes
1 answer
245 views

When I am trying to dequeue the final node in a circular linked list based queue in C++ I am getting a segmentation fault. The rest of the elements before the final one are removed successfully, its ...
Reece Humphreys's user avatar
0 votes
2 answers
1k views

I want to know that is there any java built-in package for a circular queue and if it exists then what is the constructor to use it?
user avatar
0 votes
2 answers
520 views

I have a Circular queue, but I don't know how to get a certain item from some position, the header would be: public E peeki(int index) and using a generic Iterator.
Lucas's user avatar
  • 3
0 votes
1 answer
2k views

Let's say I implement a circular queue using an array. How could I calculate the size of the queue? By size I mean the number of elements between the front and the rear. I want to use the modulo ...
Unknown's user avatar
  • 39
1 vote
2 answers
1k views

I am implemeting a circular queue in java which will accept objects (Employee) as entries. Now I have a method to edit the surname of the specific object, but somehow I cannot access the surname ...
John Floyd's user avatar
2 votes
1 answer
1k views

When an element is inserted in a queue, REAR = REAR + 1. When an element is deleted from the queue, FRONT = FRONT + 1 when queues are implemented using arrays. Now, initially, both FRONT = REAR = -1 ...
Java Enthusiast's user avatar
3 votes
2 answers
334 views

I'm need help understanding the Circular Queue concept. I read a couple post on stackoverflow and none of the answers are answering a mental block I'm having. For example say I have 8 cells in a ...
DetroitRedCoder's user avatar
0 votes
2 answers
8k views

I want to create a circular queue using linked list,also i want to create instance of that data structure(queue) not just one queue, many queues without repeating the code. this is what i came up with....
Mike's user avatar
  • 11