Implementing heap algorithom to sort a data inside an array.