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

Feat: Implement Circular Buffer in pydatastructs #672

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

frHimanshu
Copy link

Title: Implement Circular Buffer in pydatastructs

Fixes #669

Implemented Circular Buffer with the following features:

Fixed Size: The buffer has a fixed size and overwrites the oldest data when it becomes full.
Efficient Operations: Provides constant time complexity for adding and removing elements.
Wrap-Around: When the end of the buffer is reached, the next element is inserted at the beginning of the buffer (wrap-around behavior).

Methods implemented:

Initialization: Allocate a fixed-size buffer and initialize pointers.
Enqueue: Add an element to the buffer.
Dequeue: Remove an element from the buffer.
Is Full: Check if the buffer is full.
Is Empty: Check if the buffer is empty.
Peek: View the element at the front of the buffer without removing it.

Suggestions are welcomed.

@frHimanshu
Copy link
Author

@czgdp1807 Need a review please!

@frHimanshu
Copy link
Author

@anutosh491 sir please get this pr reviewed!

@frHimanshu frHimanshu changed the title Feature request: Implement Circular Buffer in pydatastructs Feat: Implement Circular Buffer in pydatastructs Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat : Implement Circular Buffer (Ring Buffer) Data Structure
1 participant