Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shpun817/circular-stack
My implementation of Circular Stack in C#.
https://github.com/shpun817/circular-stack
circular-stack csharp
Last synced: 13 days ago
JSON representation
My implementation of Circular Stack in C#.
- Host: GitHub
- URL: https://github.com/shpun817/circular-stack
- Owner: shpun817
- Created: 2020-06-24T08:58:36.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-02T12:08:51.000Z (over 4 years ago)
- Last Synced: 2024-11-10T18:50:39.585Z (2 months ago)
- Topics: circular-stack, csharp
- Language: C#
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Circular-Stack
## Introduction
Simple class. Anyone can build it. Just building this in case I need it later in my projects.
Feel free to take the code. Feel free to share what you think about my code (good, bad or ugly :)## Documentation:
### Constructor:
// Create a CircularStack with given max size, initialize it to be an empty stack ready to store objects of type T\
// Throws OverflowException when maxSize <= 0\
**_CircularStack\(int maxSize);_**
### Mutators:
// Push obj to the top of the CircularStack, wraps around the end and front if necessary\
**_void Push(T obj);_**\
\
// Pop the element at the top\
**_T Pop();_**\
\
// Change the max size of the CircularStack, getting rid of elements that cannot be stored with the new size\
// You can view it as keep popping elements out until the new stack can store the old stack\
// Throws OverflowException when maxSize <= 0\
**_void Resize(int newSize)_**
### Accessor:
// Get the element at the top without popping it out of the stack\
**_T Peek();_**