Write an algorithm that create a list C that contains only those elements that are common in list A and B

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 18PE
icon
Related questions
Question

There are two static lists A and B containing the following data:

A: 2,5,9,14,15,7,20,17,30

B: 14,2,9,13,37,8,7,28

1. Write an algorithm that create a list C that contains only those elements that are common in list A and B

2. Write an algorithm that create a list D that contains all elements of A as well as B ensuring that there is no repetition of elements

3. For Question 1, calculate the running time to create and fill the list C

Note: Only use operations of List A and List B for designing algorithms in part (a) and (b)

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning