Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You will implement a Minimum Oriented 3 - Heap data structure for String values ( MinString 3 Heap ) . 3 - Heap is a
You will implement a Minimum Oriented Heap data structure for String values MinStringHeapHeap is a data structure where each node can have a maximum of children. Other than that, the minheap rules apply: Parent node is smaller than its children. An example of a MinHeap is given below: Figure An example of a Minimum Oriented Heap for String values and how its kept on array. TASKSCopy the following java code as the starting template for your MinStringHeap implementation. public class MinStringHeap private String values; private int N ;public MinStringHeap this.values new String; public void insert String value You will implement this method Method takes a String and inserts into the Heapprivate void swimRecursive int index You will implement this method Method takes an item index andpublic String removeMin You will implement this method Method removes and returns theRECURSIVELY!swims the item up in the treeminimum element from the treeprivate void sinkRecursive int index You will implement this method Method takes an item index andpublic void delete int index You will implement this method Method takes an item index andRECURSIVELYsinks the item down in the treeremoves the item from the treepublic void update int index, String newValue You will implement this method Method takes an item index, a String and updates the items value public void printfor int iNN; iN; iSystemout.println removeMin; The MinStringHeap holds at most String values in an array and keeps the array as a Complete Tree. You will implement the methods explained in the code following the Heap rules and keeping each method in OlogN time complexity.TESTINGThe print method for the heap is already given for you in the template. Test your implementation with the given Main method below in a Main.java file, where you can also addremovechange strings to test with different inputs. public static void mainString args MinStringHeap heap new MinStringHeap; heap.insertKemal; heap.insertZerrin; heap.insertAhmet; heap.insertBeril; heap.insertCanan; heap.insertHikmet; heap.insertOkan; heap.update "Mehmet"; heap.update "Fatih"; heap.delete; heap.print; should print : Ahmet Fatih Kemal Mehmet Okan Zerrin
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started