Skip to content

shpun817/Circular-Stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

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<T>(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();

About

My implementation of Circular Stack in C#.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages