Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment you will write a program that inserts 20 random integers from 0 to 100 in order in a linked list object. The

For this assignment you will write a program that inserts 20 random integers from 0 to 100 in order in a linked list object. The program will create another linked list, but with 15 random integers from 0 – 100 in order. The program then will merge those two ordered linked list into a single ordered list.

The function merge should receive references to each of the list objects to be merged and a reference to a list object into which the merged elements will be placed. There should be no duplicate numbers in the final list.

Calculate the sum of the elements and the floating-point average of the elements.

Don’t use the STL linked list, you need to build your own linked list. You may use the one in the lecture’s example.

An example of the output:

If the first list has
10, 22, 34, 45, 48, 55, 56, 57, 57, 69, 70, 72, 74, 74, 80, 83, 84, 85, 88, 88

And the second list has
50, 55, 57, 79, 81, 84, 87, 88, 90, 92, 95, 95, 95, 96, 99

The result will:
10, 22, 34, 45, 48, 50, 55, 56, 57, 69, 70, 72, 74, 79, 80, 81, 83, 84, 85, 87, 88, 90, 92, 95, 96, 99

The sum of the final list’s elements is : xxxxx

The average of the final list is : xxxx.xx

Step by Step Solution

3.54 Rating (154 Votes )

There are 3 Steps involved in it

Step: 1

LinkedListh ifndef LLHINCLUDED define LLHINCLUDED Link list node struct node int data struct node next void sortedInsertstruct node headref struct node newnode struct node newNodeint newdata void prin... 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

Database Systems A Practical Approach to Design Implementation and Management

Authors: Thomas Connolly, Carolyn Begg

6th Edition Global

132943263, 978-0132943260

More Books

Students also viewed these Programming questions

Question

Find the first derivatives. f(P) = P 3 + 3P 2 - 7P + 2

Answered: 1 week ago