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
0
votes
1 answer

Circular Queue toString method ignoring some conditions

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 ignored. At first I thought I wasn't overriding…
0
votes
1 answer

can someone please tell is there any java built in package for Circular Queue?

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?
user9913522
0
votes
2 answers

Getting an item from one position in a Circular Queue using an iterator

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
  • 3
  • 1
0
votes
1 answer

Circular queue size using mod

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 operation. I have the capacity of the array, and the…
Unknown
  • 39
  • 2
  • 9
0
votes
2 answers

Circular Queue using Linked List

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... #include #include struct…
Mike
  • 11
  • 2
  • 6
-1
votes
1 answer

Why does my queue initializing function (c99) returns segmentation fault?

/* 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 size */ queue_t* create_queue(int capacity){ …
-1
votes
1 answer

Dequeue final node in circular linked list

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 just the last one and it seems to be an issue with…
Reece Humphreys
  • 147
  • 1
  • 8
1 2
3