Text book implementation of binary min heap