Question: Provided two sorted lists, 11 and 12, write a function in C++ to efficiently compute 11 n12 using only the basic STL list operations.
Provided two sorted lists, 11 and 12, write a function in C++ to efficiently compute 11 n12 using only the basic STL list operations. The lists may be empty or contain a different number of elements e.g. |11| # |12| You may assume 11 and 12 will not contain duplicate elements. Examples (all set members are list node): {1,2,3,4} n {2,3} = {2,3} n {2,3} = 0 {2,9, 14} {1, 7, 15} = 0 (a) Complete the function below. Do not use any routines from the algorithm header file. #include 1 2 3 4 5 6 std: : list intersection (const std::list & 11, const std::list & 12) { } // Insert Code (b) Verify that your implementation works properly by writing two test cases. (c) What is the running time of your algorithm? Provide a big-O bound. Justify. Activate Go to Settin
Step by Step Solution
There are 3 Steps involved in it
Lets start by completing the function to find the intersection of two sorted lists without using any ... View full answer
Get step-by-step solutions from verified subject matter experts
