Sign inMenu
Ashish Kumar 0 follower OfflineAshish Kumar
Ashish Kumar
Nodes in a tree can be represented using an array by numbering them starting at 0-(n-1) or 1-n (this indexing is used here).
Binary HeapsBinary Heaps
DOCX file
The (binary) heap data structure is an object in an array that can be thought of as a nearly finished binary tree. An element of the array is represented by each node in the tree. A.length, which (as normal) shows the number of elements in the array, and A.heap-size, which indicates how many elements from the heap are stored within array A, are the two properties of an object called an array A that represents a heap. Given the index I of a node, we can simply calculate the indices of its parent, left child, and right child because the tree's root is A[1].
I like - Comment - Share - 02/12/2022 11:09 - Public
© e-nautia[EN] ▲ Terms Newsletter Contact