Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

My program is in working order and is fully written out: http://pastebin.com/F0q

ID: 3536688 • Letter: M

Question

My program is in working order and is fully written out: http://pastebin.com/F0qAJmP6 The idea of my assignment is to manipulate trees in adding, removing, peeking, etc at these heaps of data, by defining a class named Heap12Tester that extends junit.framework.TestCase and that implements a test plan. And also to define a generic class Heap12> that implements the PQueue interface. The goal is to run two different types of Huffcompress in order to see how much our code can compress. My question is, can anyone think of a more efficient way of writing the add, remove, bubbleUp or trickledown methods? The pre existing code is in the link above!

Explanation / Answer

It's not possible to get a more efficient code, in terms of time complexity. Your code takes O(logn) time for each operation, which would be minimum time taken for any heap.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote