Купа (структура даних)




Приклад повної бінарної купи


Купа, стіс[1][2] або піраміда (англ. heap) в інформатиці — спеціалізована деревовидна структура даних, в якій існують певні властивості впорядкованості: якщо В — вузол нащадок A — тоді ключ(A) ≥ ключ(B). З цього випливає, що елемент з найбільшим ключем завжди є кореневим вузлом. Не існує ніяких обмежень щодо максимальної кількості елементів-нащадків повинна мати кожна ланка, однак, на практиці, зазвичай, кожен елемент має не більше двох нащадків. Купа є однією із найефективніших реалізацій абстрактного типу даних, який має назву черга з пріоритетом. Купи відіграють критичну роль у низці ефективних алгоритмів роботи з графами, як то в алгоритмі Дейкстри та в алгоритмі сортування пірамідальне сортування. Найуживанішим класом куп є бінарні купи.


Базові операції з купою такі:


  • підтримка основної властивості купи

  • побудова купи з невпорядкованого масиву

  • сортування купи

  • видалення найменшого елемента

  • отримання найбільшого елемента

  • додавання елемента

Купи часто використовуються для моделювання черг з пріоритетами.



Див. також |


  • Стек

  • Бінарна купа


  • d-арна купа

  • Біноміальна купа

  • Фібоначчієва купа


Примітки |




  1. ↑ heap // Англійсько-український словник з математики та інформатики / Уклад. Є. Мейнарович, М. Кратко — 2010.


  2. ↑ Кочерга О., Мейнарович Є. Англійсько-українсько-англійський словник наукової мови (фізика та споріднені науки). — Вінниця: Нова книга, 2010.





Popular posts from this blog

AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

Property … does not exist on type 'IntrinsicAttributes & …'property does not exists on type ''Angular 2 beta.17: Property 'map' does not exist on type 'Observable<Response>'Can't bind to 'ngModel' since it isn't a known property of 'input'TypeScript TS2339 error in React component: Property 'xyz' does not exist on type 'IntrinsicAttributes…'property of type forEach does not exist on type voidAdd onclick listener reactjsProperty 'pictures' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributesTypescript redux connected component type errorTypescript+React+Redux+reactrouter:“property does not exist on type IntrinsicAttributes & IntrinsicClassAttributes” passing props from parent to childUnable to set ref due to error “TS2339: Property 'X' does not exist on type 'Y' ” inside a react component

C# Print list of string array The Next CEO of Stack OverflowUseless output to console when printing result of ReadAllLinesC# & very new Programming in generalWhat is the difference between String and string in C#?How do I check if a list is empty?Create ArrayList from arrayFinding the index of an item given a list containing it in PythonHow to append something to an array?How to make a flat list out of list of lists?How to check if an object is an array?How do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?Why not inherit from List<T>?