The data structure for a tree is an array T, where the first element, T[1], is the element at the root, and the descendants of the element T[i] are T[2*i] and T[2*i+1] (but only when numbering elements of an array starting with 1). Then, using this rule, we can represent the following heap as the array that's below it:
[16, 11, 9, 10, 7, 3, 4, 6, 5]Given a set of trees (1 in each row). It is necessary to determine for every one of them whether it is a max-heap or a min-heap. Otherwise, output "not-heap".