UNIVERSITY OF Sahiwal, SAHIWAL INTERNAL EXAMINATION COMPUTER SCIENCE DEPARTMENT Final-Term Examination fall 2020 Program: BSCS Semester/Shift: 3rd (M-1) Course Title: Data Structures and Algorithm Teacher’s Name: Ms. Quratulain Shoaib Question 1: Roll No: ___ 2019-CS-3931_______ Student Name: __________________ Maximum Time: 2:00 Hour Total Marks: 50 (marks: 25) The Bubble Sort implementation has the following inner for loop: for (int j=n-1; j>i; j--) Consider the effect of replacing this with the following statement: for (int j=n-1; j>0; j--) Would the new implementation work correctly? Would the change affect the asymptotic complexity of the algorithm? How would the change affect the running time of the algorithm? Question 2: (marks: 25) What is the primary conceptual disparity among a stack and a queue? In Brief illustrate exactly how to efficiently apply a stack using an array. Also in briefly illustrate how to efficiently implement a stack using a linked list.