Question: A trinary heap is a heap in which each node has up to 3 children (a left child, a center child, and a right child).


A trinary heap is a heap in which each node has up to 3 children (a left child, a center child, and a right child). Since it's a heap, each level of the heap must be filled before a new level is started, and each partially-full level of the heap must be filled left to right. For example, here is a trinary min-heap containing 12 numbers: 19 18 14 37 20 A common way of working with binary heaps is to store them in an array. In this case, the 0-th element of the array is the head, and for the element at index j its two children are at indices 2/+1 and 2/+2. For example, here's a binary heap and an array that would store it 14 19 20 18 Index 2 4 5 Value 2 4 20 18 30 Part A:15 pts] You can also store trinary heaps in an array using the same idea as the above idea for binary heaps. For a trinary heap, if an element of the heap is stored at index k, what are the indices of its 3 children
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
