Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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)

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.