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

Data structures/queue using array2.cpp #2923

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ehtashammd07
Copy link

update a queue

fixes #2690

Issues in your code:
Deque() causes incorrect shifting

The shifting logic in Deque() is incorrect.
Instead of shifting all elements and updating rear, use front to track the front element.
Incorrect Underflow condition

If front == rear, the queue is empty, but you still proceed with shifting.
Hardcoded queue size (10)

You are not handling a circular queue approach, which is more efficient for queues.
Loop exits incorrectly in main()

The loop should have an explicit exit condition (0 isn't handled)

@ehtashammd07
Copy link
Author

final update

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.

[BUG] error: reference to 'queue' is ambiguous
1 participant