I made an array of integers (arr in the code) which has the Heap binary tree property so that the i-th node has leftChild = i*2+1 and