File tree 2 files changed +28
-1
lines changed
src/data-structures/stack
2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Stack
2
2
3
+ _ Read this in other languages:_
4
+ [ _ 简体中文_ ] ( README.zh-CN.md ) ,
5
+ [ _ Русский_ ] ( README.ru-RU.md )
6
+
3
7
In computer science, a ** stack** is an abstract data type that serves
4
8
as a collection of elements, with two principal operations:
5
9
@@ -13,7 +17,7 @@ the stack. The name "stack" for this type of structure comes
13
17
from the analogy to a set of physical items stacked on top of
14
18
each other, which makes it easy to take an item off the top
15
19
of the stack, while getting to an item deeper in the stack
16
- may require taking off multiple other items first
20
+ may require taking off multiple other items first.
17
21
18
22
Simple representation of a stack runtime with push and pop operations.
19
23
Original file line number Diff line number Diff line change
1
+ # Стек
2
+
3
+ Стек (англ. stack — стопка) — абстрактный тип данных, представляющий собой
4
+ список элементов, организованных по принципу LIFO (последним пришёл — первым вышел).
5
+
6
+ Стек имеет две ключевые операции:
7
+ * ** добавление (push)** элемента в конец стека, и
8
+ * ** удаление (pop)** , последнего добавленного элемента.
9
+
10
+ Дополнительная операция чтения головного элемента (peek) даёт доступ
11
+ к последнему элементу стека без изменения самого стека.
12
+
13
+ Чаще всего принцип работы стека сравнивают со стопкой тарелок: чтобы взять вторую
14
+ сверху, нужно снять верхнюю.
15
+
16
+ Иллюстрация работы со стеком.
17
+
18
+ ![ Стек] ( https://upload.wikimedia.org/wikipedia/commons/b/b4/Lifo_stack.png )
19
+
20
+ ## Ссылки
21
+
22
+ - [ Wikipedia] ( https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D0%B5%D0%BA )
23
+ - [ YouTube] ( https://www.youtube.com/watch?v=tH8qi7lej5U )
You can’t perform that action at this time.
0 commit comments