Heaps, also known as priority queues, are a type of tree data structure where every node satisfies the heap property, either as a max-heap or min-heap. Heaps are complete binary trees and can be efficiently represented using arrays. Key operations include adding and removing elements while maintaining the heap property. The
Table of contents
Permalink IntroductionPermalink How to represent a heap?Permalink Preparing the interfacePermalink Implementing heappush()Permalink Implementing heappop()Permalink Creating a heap using an exisiting arrayPermalink Time and space complexityPermalink What about max-heap?1 Comment
Sort: