[binary heap] completed re-writing