Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.Implementation of the Merge List Function (for Merger of Unique Elements) for Singly Linked List and the Time Complexity Analysis In the code given to

1.Implementation of the Merge List Function (for Merger of Unique Elements) for Singly Linked List and the Time Complexity Analysis

In the code given to you for this project(SEE APPENDIX ONE ON PAGE 4) , you can notice in the main function that you will be creating two lists (called firstIntegerList and secondIntegerList) of the same size (listSize) and whose values are in the range [1...maxValue]. Add a member function mergeList to the Singly Linked List-based implementation of the List ADT. The member function takes as input a List object (representing the second integer list) as parameter and appends it to the List object (representing the first integer list) on which the function will be called. You should append only those elements (from the second integer list) that are not already in the first integer list. Feel free to creatte additional member functions to facilitate this. For example: if the firstIntegerList is 11 --> 22 --> 44 --> 55 --> 78 --> 89 and the secondIntegerList is 22 --> 56 --> 89 --> 77 --> 32 --> 55, then the contents of the firstIntegerList (after the merger) should be : 11 --> 22 --> 44 --> 55 --> 78 --> 89 --> 56 --> 77 --> 32.

Submit a report that has the following:

A. (a - 10 pts) Explain the logic/algorithm that you incorporated to your code to accomplish the merger of only unique elements: i.e., to merge an element (from the secondIntegerList) to the firstIntegerList only if the element is not already in the latter.

B. (b - 10 pts) Provide a pseudo code for the entire merge list function (including the logic for merger of unique elements) and analyze its time complexity as a function of the list size, n.

C. (b - 20 pts) Include the complete C++ code comprising of the Node class, List class with all the added member functions and the main function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions