You are on page 1of 97
Course: DATA- ‘Session: Linked List ‘Timestamp: October 9, 2017, 8:11 Register Number: STRUCTURE Implementati am RAT611003010411 Q. Intersection of two Sorted SLL Given two lists sorted in increasing order, create and return a new lis! representing the intersection of the {wo lists. The new list should bbe made with its own memory the original sts should not be changed. For example, let the firs inked list be 1->2->3->4->6 and second linked list be 2->4->6->8, then your function should create and retum a third list as 2->4->6. INPUT First line contains 2 int Nt and N2 as number of students of class A and B respectively. Second line contains N1 integers (heights of students of class A in ascending order). Third line contains N2 integers (heights of students of class 8 in ascending order). OUTPUT Display the list! Display the list2 Display the common lst Source Code ‘ince using namespace std; inimaing) i Inte ‘aroont>one: Intajnt bina}. ket 062-0, torleOicnt 34+) ( cena) ) fonoy"ecalh ) ‘coutce"Lst 2"ccen torl-0ienae+) ( eostecstocb ) ‘oute<"nCommon lat axerss forl-Oicnt ++) ( tort0s2ye+) ‘ “ono itt ( coutee’-s" int main() ( Intia; Int k(50]; scanf("éd,n) forile0:teni++) ( soant("%ed", aK, ) forll

You might also like