Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tlmader/stack-and-queue
Allows the storing of strings in a data structure in the form of either a stack or queue.
https://github.com/tlmader/stack-and-queue
Last synced: 1 day ago
JSON representation
Allows the storing of strings in a data structure in the form of either a stack or queue.
- Host: GitHub
- URL: https://github.com/tlmader/stack-and-queue
- Owner: tlmader
- Created: 2013-11-14T02:34:47.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-10-08T20:45:03.000Z (about 10 years ago)
- Last Synced: 2024-04-14T22:56:56.564Z (7 months ago)
- Language: Java
- Size: 176 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
stackandqueue
=============University of New Orleans Software Design I Homework Seven – Stacks and Queues
#### Class Stack:
Everything added will be pushed onto the top of the stack and everything removed will be popped from the top. The underlying data structure for this stack is an Array. The array will store Strings. Stack has five methods: push, pop, peek, isEmpty, and size. Push accepts as a parameter a String and adds it to the top of the stack. Pop removes the element from the top of the stack and returns it. Peek returns the element at the top of the stack without removing it. isEmpty returns a Boolean that is true is there are no element in the stack. Size returns the number of elements in the stack. The array dynamically expands as you push more elements onto the stack.#### Class Queue:
Everything is added to the back of the queue and everything is removed from the front. As above, the underlying data structure is an Array that stores Strings. Queue has five methods: add remove, peek, isEmpty, and size. Add accepts as a parameter a String and adds it to the back of the queue. Remove removes and returns the element at the front of the queue. Peek returns the element at the front of the queue without removing it. isEmpty and size are the same as they are in Stack.#### Testing:
StackAndQueue.java contains instructions for a test program that ensures every method is working properly. It tests normal cases, boundary cases, what happens during an attempt to pop an element off an empty stack, what happens during an attempt to add more elements to the queue than the default size of the array, and ensures everything is working.