File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
src/data-structures/stack Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Stack
2
+
3
+ In computer science, a stack is an abstract data type that serves
4
+ as a collection of elements, with two principal operations:
5
+
6
+ * ** push** , which adds an element to the collection, and
7
+ * ** pop** , which removes the most recently added element that was not yet removed.
8
+
9
+ The order in which elements come off a stack gives rise to its
10
+ alternative name, LIFO (last in, first out). Additionally, a
11
+ peek operation may give access to the top without modifying
12
+ the stack. The name "stack" for this type of structure comes
13
+ from the analogy to a set of physical items stacked on top of
14
+ each other, which makes it easy to take an item off the top
15
+ of the stack, while getting to an item deeper in the stack
16
+ may require taking off multiple other items first
17
+
18
+ Simple representation of a stack runtime with push and pop operations.
19
+
20
+ ![ Stack] ( https://upload.wikimedia.org/wikipedia/commons/b/b4/Lifo_stack.png )
21
+
22
+ ## References
23
+
24
+ [ Wikipedia] ( https://en.wikipedia.org/wiki/Stack_(abstract_data_type) )
You can’t perform that action at this time.
0 commit comments