Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are given a list, L, and another list, P, containing integers sorted in asce

ID: 3775522 • Letter: Y

Question

You are given a list, L, and another list, P, containing integers sorted in ascending order. The operation printLists(L,P) will print the elements in L that are in positions specied by P. For instance, if P = 1, 3, 4, 6, the elements in positions 1, 3, 4, and 6 in L are printed. Write the procedure printLists(L,P). Q2. Swap two adjacent elements by adjusting only the links (and not the data) using singly linked list. Q3. Given two sorted lists, L1 and L2, write a procedure to compute L1 L2 using only the basic list operations. Q4. Given two sorted lists, L1 and L2, write a procedure to compute L1 L2 using only the basic list operations.

help me :( :( i want solution in c++   

Explanation / Answer

import java.util.Arrays;

import java.util.LinkedList;

public class Lists

{

public static void main(String[] args)

{

LinkedList<Integer> L1 = new LinkedList<Integer>();

LinkedList<Integer> L2 = new LinkedList<Integer>();

L1.addAll(Arrays.asList(4,9,13,50,65,87,91,99));

L2.addAll(Arrays.asList(1,3,4,6));

int sample=L2.size();

for(int i=0;i<sample;i++)

{

System.out.println(L1.get(L2.get(i)));

}

System.out.println(L1);

System.out.println(L2);

System.out.println(sample);

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote