finish the implement of heap