Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/monamobeen/stackquiz
Simple Stack Implementation (Array-Based)
https://github.com/monamobeen/stackquiz
stack
Last synced: 3 days ago
JSON representation
Simple Stack Implementation (Array-Based)
- Host: GitHub
- URL: https://github.com/monamobeen/stackquiz
- Owner: MonaMobeen
- Created: 2024-06-13T10:35:17.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-14T09:16:32.000Z (7 months ago)
- Last Synced: 2024-06-14T17:42:39.856Z (7 months ago)
- Topics: stack
- Language: C++
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Instructions
This assignment involves analyzing and correcting a buggy stack implementation.## Part 1: Identifying and Fixing Bugs
Review the Code: Open the stack.cpp file and examine the code for the Stack class.
Identify Errors: Look for lines that might be causing unexpected behavior.Are the conditions in isEmpty() and isFull() accurate?
Is the top variable used correctly to track the stack position?
## Fix the Code:
Once you've identified the bugs, modify the problematic lines in stack.cpp to correct the functionality.
## Part 2: Testing and Verification
Compile and Run: After fixing the bugs, compile and run the code.
Test Functionality: Use the push and pop methods of the Stack class to test its behavior. Verify that it now operates correctly according to the Last-In-First-Out (LIFO) principle.
# Bonus Challenges:
Implement a peek() function in stack.cpp to view the top element without removing it.
Explore alternative ways to handle stack overflow and underflow conditions.## Resources:
For a refresher on stacks and LIFO:
Online tutorials and documentation on C++ arrays and stacks can be helpful resources.