forked from trekhleb/javascript-algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Translate heap into Russian. Add links to main README file. (trekhleb…
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Куча (структура данных) | ||
|
||
В компьютерных науках куча — это специализированная структура данных типа дерево, которая удовлетворяет свойству кучи: | ||
если B является узлом-потомком узла A, то ключ(A) ≥ ключ(B). Из этого следует, что элемент с наибольшим ключом всегда | ||
является корневым узлом кучи, поэтому иногда такие кучи называют max-кучами. | ||
|
||
![Max-куча](https://upload.wikimedia.org/wikipedia/commons/3/38/Max-Heap.svg) | ||
|
||
Если сравнение перевернуть, то наименьший элемент будет всегда корневым узлом, такие кучи называют min-кучами. | ||
|
||
![Min-куча](https://upload.wikimedia.org/wikipedia/commons/6/69/Min-heap.png) | ||
|
||
Не существует никаких ограничений относительно того, сколько узлов-потомков имеет каждый узел кучи. На практике их | ||
число обычно не более двух. Куча является максимально эффективной реализацией абстрактного типа данных, который | ||
называется очередью с приоритетом. | ||
|
||
Узел на вершине кучи, у которого нет родителей, называется корневым узлом. | ||
|
||
## Ссылки | ||
|
||
- [Wikipedia](https://ru.wikipedia.org/wiki/Куча_(структура_данных)) | ||
- [YouTube](https://www.youtube.com/watch?v=noQ4SUoqrQA) |