Not looking for a full solution. Just a clue in the right direction. In Data Str
ID: 3819236 • Letter: N
Question
Not looking for a full solution. Just a clue in the right direction. In Data Structures: Abstraction and Design for Java, Ed 4(Koffman & Wolfgang) Ch 6 # 10 pg. The question is not entirely clear as to what to build. Is the expectation that the Heap should be implemented as a binary tree, or should it be implemented as an ArrayList? The text discusses it as an ArrayList and provides some examples however it does not show it as a binary tree other than in pictures.
- Here is the question.
Create an abstract class Heap that has two concrete subclasses, MinHeap and MaxHeap. Each subclass should have two constructors, one that takes no parameters and the other that takes a Comparator object. In the abstract class, the compare method should be abstract, and each subclass should define its own compare method to ensure that the ordering of elements corresponds to that required by the heap. For a MinHeap, the key in each node should be greater than the key of its parent; the ordering is reversed for a MaxHeap.
-Thanks
Explanation / Answer
Its told that the Heap should be inplemented as an arraylist wull be the perfect way to go for this problem
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.