Question: 18.0 Points Create a wave class called Specialist. This class will be a singly linked data structure composed of LinearNode objects (see the attached Linear




18.0 Points Create a wave class called Specialist. This class will be a singly linked data structure composed of LinearNode objects (see the attached Linear Node class). Each list will be given a dividing fine" (let's call it 'd') such that elements less than d are on the left side of the list and elements greater than d are on the right side. The elements should not be sorted completely but must be divided to the two sides of the list Whenever an element is added to the list, it must be compared to d to see which side of the list is should be added to fit less than a the element must be added at the front of the list so that it becomes the new front. If it greater than d add the item to the end of the list so that it becomes the last element of the list. We can assume that elements will never be equal tod for simplicity The class must have the following 2 instance variables you may NOT change or add any instance variables); private LinearNodecinteger front private int : The class must have a constructor which takes in a parameter d with which you must initialize the instance variable d Initialize front as null. The class mus also have a getter method getFront() to return the front pointer. The most important method of this class is addToList (Integer element) in which you must perform the main task of determining which side of the list to add the new element to, based on the value of a. You also must create a new LinearNode_Integer containing the new element and then add it to the correct side of the existing list (either the very front or the very end). The front pointer must be correctly updated when necessary and the connections front rode to node must be correctly updated as well. Hint: there are multiple cases to consider, te the very first element vs. a new element
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
