maxheap takes objects with property of frequency