Questions tagged [circular-queue]

Tag for questions about Circular Queues. They are linear FIFO data structures in which the last position is connected back to the first position to make a circle. Also known as "circular buffer", "cyclic buffer", "ring buffer".

A Circular Queue (also known as "circular buffer", "cyclic buffer", "ring buffer") is a linear data structure which operates using the FIFO (First In First Out) principle. The particularity of Circular Queues is that the last position is connected back to the first position to make a circle.

37 questions
1
vote
0 answers

Can anyone please explain how can I implement my code to add an element to the back of a circular arraydeque?

I have declared a class ArrayDeque which takes in an Circular Array A1 and I want to try and add an element to the back of the Array. I have only declared variable such as head and tail and size and intialized them. However, I'm completely stuck on…
Droid
  • 520
  • 1
  • 7
1
vote
1 answer

Why is my Circular Array Queue not adding the very last inputted value?

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 re-enqueuing values and it worked fine until I…
ihill
  • 23
  • 6
1
vote
0 answers

POST data will not enqueue to PHP Circular Queue

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-sanitised to a file save.php with the queue.php…
rxm
  • 71
  • 2
  • 11
1
vote
2 answers

simple patient managing program using queue

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, but It doesn't work. is_empty() always return front and rear is…
crakel
  • 11
  • 3
1
vote
2 answers

Circular Queue in Java

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 setter method found in the Employee class from the…
John Floyd
  • 13
  • 5
0
votes
0 answers

Confusion about enqueue-ing datas into circular-queue recursively

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 defined recursively. Here is some example which…
bFur4list
  • 133
  • 3
0
votes
0 answers

Trying to sort a Circularqueue and rearrange another queue according to the sorted one

As i mentioned, I am trying to sort a Circular queue and rearrange another Circularqueue according to the sorted one. I know it is too beginner for stackoverflow but it is my last chance. The part of the algorithm that sort but not working properly.…
0
votes
0 answers

The runtime complexity of the clear function for a vector based queue of integers where the front of the queue is not necessarily at the 0th position

The question is If we’re storing a queue of integers using a vector (not a list) you may store items in such a way that the front of the queue is not necessarily at the zero position. If using this technique, what would be the Big-Theta runtime of…
Zhou Fang
  • 23
  • 3
0
votes
0 answers

Undefined reference to copy

This is a function for doubling the circular queue capacity in C (https://i.stack.imgur.com/xxhah.jpg) Code source : Fundamentals of data structures in C #include #include typedef struct { int key; } element; element…
0
votes
0 answers

How can we grow an array in a circular buffer / circular queue implementation

I'm trying to learn about the implementation of a circular queue using arrays, and currently, my main source of learning how it works is through this page. https://www.happycoders.eu/algorithms/implement-deque-using-array/ However, I'm struggling to…
Nutnicha
  • 335
  • 1
  • 10
0
votes
0 answers

Circular Queue getting rid of item in the text field after clicking dequeue button

I am trying to create a Java Gui with a circular queue array that has ten elements, and I can't seem to properly dequeue an item in the text field. Every time I click on the Dequeue Button all the other text field are the one that are affected…
Beta
  • 1
  • 1
0
votes
0 answers

Implementation of Circular Queue using array

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, it doesnt work when I try to dequeue after adding…
0
votes
0 answers

Handling Unknown user input in C

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 different testcases i am given with different data types.…
0
votes
1 answer

Front and rear pointers of circular queue exceed the size of array

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 helpful if someone could point out where I am…
0
votes
1 answer

Circular Queue in Javascript

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 the value of var i in each method. var i =…
1
2 3