Skip to content

GH-264: Stack in General #265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ A data structure is a data organization, management, and storage format that is
<a href="/concepts/general/linked-list/README.md">Linked List</a>
</li>
<li>
<code>B</code> Stack
<a href="/concepts/python/stack.md"><code>py🐍</code></a>
<a href="/concepts/typescript/stack.md"><code>ts</code></a>
<code>B</code>
<a href="/concepts/general/stack/README.md">Stack</a>
</li>
<li>
<code>B</code> Queue
Expand Down
26 changes: 26 additions & 0 deletions concepts/general/stack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Stack

*See implementation in*
C++,
Java,
[Python](/concepts/python/stack.md),
[Typescript](/concepts/typescript/stack.md)

In computer science, a stack is an abstract data type that serves as a collection of elements, with two main operations: `Push`, which adds an element to the collection, and `Pop`, which removes the most recently added element that was not yet removed.

## Stack Operations

Here are some basic operations that you can perform on stacks:

* `push(item)`: Adds an item to the top of the stack.
* `pop()`: Removes the top item from the stack.
* `peek()`: Returns the top of the stack.
* `isEmpty()`: Returns true if and only if the stack is empty.
* `size()`: Returns the number of items in the stack.

## 🔗 Further Reading

* ▶️ [Stack Introduction](https://youtu.be/L3ud3rXpIxA?list=PLDV1Zeh2NRsB6SWUrDFW2RmDotAfPbeHu), Data structures playlist, WilliamFiset, 2017
* ▶️ [Stack Implementation](https://www.youtube.com/watch?v=RAMqDLI6_1c&list=PLDV1Zeh2NRsB6SWUrDFW2RmDotAfPbeHu&index=9&ab_channel=WilliamFiset), Data structures playlist, WilliamFiset, 2017
* ▶️ [Stack Code](https://www.youtube.com/watch?v=oiZssCfk4_U&list=PLDV1Zeh2NRsB6SWUrDFW2RmDotAfPbeHu&index=10&ab_channel=WilliamFiset), Data structures playlist, WilliamFiset, 2017
es the most recently added element that was not yet removed.