Question: The linked list based implementation of the SortedType class is to be extended with the method: public boolean mergeLists(Sortedtype list) which merges the passed list

 The linked list based implementation of the SortedType class is to

The linked list based implementation of the SortedType class is to be extended with the method: public boolean mergeLists(Sortedtype list) which merges the passed list into the encapsulated list. Write an efficient java code of the method without using any of the class methods Also, assume that there is no tail and that the 2 lists have no duplicate numbers in the list irself or the other list ffor example: list1: 379 and listz. 6. 8). The method uses a boolean called empty that returns false if the encapsulated list is empty and true if is not empty but after the merging is complete. Note that you should assume all possibilities, such as empty list, or many items in the list. You are also requested to use the inch Worm technique (using 2 references: prev and cur) to insert the elements of the passed list into the encapsulated one. Don' forget that use of s. Ws. > or >= with the generic E requires casting whereas with = or t= there is no need for casting Hint: if the encapsulated list is empty then it is a special case and can merge the fwo lists and return without doing any loop ithink howl otherwise you have to write 2 nested loops to complete the merging

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!