s/weight/frequency/ and remove unused variable
implement MinHeap