Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add Circular FIFO Queue Implementation #31

Open
Kalkwst opened this issue Jan 14, 2023 · 0 comments
Open

✨ Add Circular FIFO Queue Implementation #31

Kalkwst opened this issue Jan 14, 2023 · 0 comments
Labels
enhancement The issue is a suggestion for a new feature or improvement to an existing feature

Comments

@Kalkwst
Copy link
Owner

Kalkwst commented Jan 14, 2023

A circular FIFO (First In First Out) queue is a type of queue data structure that is similar to a regular queue but with the added feature of being able to "wrap around" when it reaches the end. This allows for more efficient use of memory, as the oldest element is overwritten when a new element is added to a full queue, instead of having to allocate additional memory for a new element.

From a more technical perspective, a circular FIFO queue is a data structure that follows the FIFO principle, where the first element added to the queue is the first one to be removed. The difference is that when the last position of the queue is reached, the next element will be added at the first position, overwriting the oldest element. The queue has two pointers, one pointing to the front of the queue and the other pointing to the next free position. When an element is dequeued, the front pointer is incremented, and when an element is enqueued, the next free position pointer is incremented, if the next free position pointer reaches the end of the queue, it wraps around to the first position. This way, the queue can use a fixed amount of memory and it's efficient in terms of memory usage and time complexity, as both enqueue and dequeue operations have constant time complexity O(1).

@Kalkwst Kalkwst added the enhancement The issue is a suggestion for a new feature or improvement to an existing feature label Jan 14, 2023
@Kalkwst Kalkwst mentioned this issue Jan 14, 2023
26 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is a suggestion for a new feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant