Question: a ) ( 2 pts ) Given two sorted singly linked lists, define a method merge that merges the given lists into a third one

a)(2 pts) Given two sorted singly linked lists, define a method merge that merges the given lists into a third one that will also be sorted and contains the duplication of the elements.For example, if the first list contains {1,2,2,4,6), and the second contains (2,6,7), the result should be {1,2,2,2.4.6,6,7}.If one of the given lists is empty, your method should return the head reference of the other list.Possible header:public static NODE merge(NODE headi, NODE head2)(//head and head2 are the heads' references to I/the first and the second lists respectivelyb)(0.5 pt) Determine the time complexity of your method using the Big-Theta notation in terms of m and n, the lengths of the lists.

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 Programming Questions!