Basic Concept Of Heap
Hello everyone, so today we're going to talk about something called Heap. So according to wikipedia, heap is a specialized-data structure that satisfies the heap property. It is also said that it implements the concept of priority queue in data structure. Pretty confusing, eh. To make things easier to comprehend, I came up with my own definition of heap if you dont mind. To me, heap is like a compilation of sorted array that is unifies in the end as root node. Here is an illustration of heap: (max-heap) Based on my explanation, I see that heap as 5 array of data : 1. array of [100,19,17,2] 2. array of [100,19,17,7] 3. array of [100,19,3] 4. array of [100,36,25] 5. array of [100,36,1] See how it all starts with 100? That's what I meant by "they unifies in the end [it is indeed an end if you look from bottom to top]". But, there's more to it though, if you look closely, all of those arrays are sorted in descending order from the top to bott...