-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Rework on Stack Array Data Structure #2683
Conversation
- The `Stack` class is placed within the `data_structures` namespace - The destructor is added to the Stack class to ensure memory deallocation - Comments are added to the member functions to describe their purpose - The self-test function is provided, which demonstrates the usage of the Stack class
Please take a look on this PR @realstealthninja, @Panquesito7 |
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Could you have a look on this PR @realstealthninja |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both maintainers of this repo are rather busy these days, so I'll do a quick review.
Very solid rework and documentation. Have you considered adding methods like empty()
and full()
? They might help client code to handle these cases before operations like pop()
and push()
.
Overall I think this is merge-worthy. Up to the maintainers to make further decision :)
Can you add don't-close label for this PR, @mrmagic2020? |
Sorry, I don't have write access to this repo... you still need to wait for the maintainers |
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very lovely contribution. Other than some technical assumptions being wrong. This is a great implementation. I would recommend using TOS instead of stack index. The bottom is unnecessary imo since stack follows lifo principle
- Use TOS instead of stack index - Add tests for overflow and underflow
Thanks, @realstealthninja. Can you have a look? |
Thanks for the quick fixes. |
@TruongNhanNguyen could you delete the stack.hpp file from that directory as well? thanks. |
On second thought revert that, we can do that in another pr. Sorry for the confusion. The stack.hpp problem seems out of the scope of this pr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! ❤️
Thanks for kindly reviews, and quick responses. This PR existed for a long time, so I am delighted to see it merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit this the most recent push must be done by you
Merging this! thanks for your contribution ❤️ |
What I have done in this PR:
data_structure
namespace andStack
classStack
class to ensure memory deallocationStack
class and its methods.Description of Change
Checklist
Notes: