using frequencies for generating a heap now