stuff
This commit is contained in:
40
4-stack/README.md
Normal file
40
4-stack/README.md
Normal file
@ -0,0 +1,40 @@
|
||||
Stack
|
||||
=====
|
||||
|
||||
Wikipedia on [stacks](http://en.wikipedia.org/wiki/Stack_(abstract_data_type)).
|
||||
|
||||
Similarly, the Linked List, a stack is an abstract data type. It is LIFO, or Last In First Out. Each node holds data and a pointer to the next node.
|
||||
|
||||
###Visualization
|
||||
|
||||
|42|
|
||||
|
|
||||
|60|
|
||||
|
|
||||
|99|
|
||||
|
|
||||
|3|
|
||||
|
|
||||
None
|
||||
|
||||
The main operations available to the Stack are push and pop.
|
||||
- Pop should remove the top node and return it.
|
||||
- Push should add to the top of the stack.
|
||||
|
||||
###Methods
|
||||
|
||||
Create your datatypes and create the following methods:
|
||||
|
||||
- push - adds to the stack
|
||||
|
||||
- pop - removes from the top of the stack
|
||||
|
||||
- peek - Find the item at the top of the stack
|
||||
|
||||
- empty - Is the stack empty?
|
||||
|
||||
###Additional Methods
|
||||
|
||||
In the wikipedia article, read under the title "Hardware Stacks". Emulating a hardware stack, add the operations it lists to your class. This is open ended and implementation is up to you.
|
||||
|
||||
|
3
4-stack/stack.py
Normal file
3
4-stack/stack.py
Normal file
@ -0,0 +1,3 @@
|
||||
class Stack:
|
||||
def __init__():
|
||||
pass
|
Reference in New Issue
Block a user