The Heap data structure can be implement using an array.
The array must maintain the main heap property: for each next conditions must hold:
If , then
If , then
The array of integers is given. Determine whether it is a heap.
First line contains number . Second line contains integers that do not exceed by absolute value.
Print "YES", if the array is a heap and "NO" otherwise.