I want to know if java has any collection that can help me with minheap and maxheap implementation.
I know I can use PriortyQueue data structure to implement maxheap.
Can we use same for minheap? If yes, How?
Thanks,
Manan
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think you have it backwards: a heap is a way of implementing a priority queue. As for the min / max part, simply write the appropriate
Comparatorclasses.