DSA Theory Questions For SPPU
DSA Theory Questions For SPPU
DSA Theory Questions For SPPU
Q.3 A) Define the terms: Data, Data Type, Data Structure with one example each. 6M
B) What is the formal definition of an algorithm? Explain with one example. 6M
Q.5 (a) Write an algorithm that finds the sum of first N integers. 6M
(b)Explain Persistent & Ephemeral Data Structures. 6M
-------------------------------------------------------------------Unit 2---------------------------------------------------------------
Q.1 A) Define the data structure ordered list (or Linear List) and with suitable examples. How can it be implemented?
(Ref: T2 page: 86, 87) 6M
B) Explain the different representations of a single variable polynomial using arrays? (Ref: T2 – 88- 90) 6 M
Q.2 A) What is linear data structure? Explain the concept of sequential organization with a suitable example.
6M
B) Write a pseudocode to add two polynomials. Discuss about its complexity. 7M
Q.3 A) Write a pseudo C++ code to perform addition of two matrices. Discuss about is complexity. 6M
B) Explain Memory representation and address calculation for a 1-D and a 2-D array with suitable example for each. (Ref.
R3 - Page 28 - 37) & (Ref. T2 - Page 108 - 112) 6M
Q.5 A) What is a sparse matrix? What are the advantages of sparse matrix over the 2-D array? Explain the ADT of sparse
matrix. 6M
B) Write short notes on Standard Library functions for string operations. 7M
--------------------------------------------------------------Unit 3-----------------------------------------------------------------------------
Q.1 a) Write a C++ function multint(p,q)to multiply 2 long positive integers represented by singly circular linked list. (Ref:
R3 pg: 244)
b) How can a polynomial in three variables (x, y and z) be represented by CLL? Explain addition of two such polynomials.
(Ref: R3 pg: 245)
Q.2 a) Write a routine addsame to add two long integers of same sign represented by DLL. (Ref R3 Pg: 245)
b) Write an ADT for class CircList to implement CLL. (Ref R3 pg: 248)
Q.3 a) Write an ADT for class DoubleList to implement DLL. (Ref R3 pg: 248)
b) Write short notes on:
i) Singly linked list
ii) Circular linked list
Q.4 A) Write an algorithm with appropriate illustrations to perform the following operations on Singly Linked list
(SLL). Delete a node (Start, end, intermediate). 6M
B) What is a Doubly Linked List? Compare it with Singly Linked List in terms of pros and cons. 7M
Q.5 a) Draw and explain circular linked list. State the limitations of singly linked list. 6M
b) Write a function PUSH & POP in C++ for stack using linked list. 7M
---------------------------------------------------------------Unit 4-------------------------------------------------------------------
Q. 1 a) Simulate the action of algorithm by showing the contents of stack at each point: (Ref: R3 pg: 85) 7 M
i) (A+B})
ii) {[A+B]-[(C – D)]
b) What set of Conditions are necessary and sufficient for a sequence of PUSH and POP operations on single stack (initially
empty) to leave the stack empty and not cause underflow? (Ref: R3 pg: 86) 6M
Q. 2 a) Implement stack in C++ where each item on the stack in a varying number of integers & design PUSH & POP
operations. (Ref R3 pg: 95) 6M
b) Transform each of following expressions to prefix and postfix: (6 marks each) (Ref: R3 pg: 115) 6M
i) (A + B) * (C - D) $ E * F
ii) (A + B) * ( $ (D – E) + F) – G
Q. 3 a) Apply evaluation algorithm for postfix expressions (Assume A=1, B=2, C=3): (Ref: R3 pg: 115) 7 M
i) AB + C – BA + C $ -
ii) ABC + * CBA - + *
b) Write an algorithm to convert: (Ref: R3 pg: 115) 6M
i) Prefix to postfix
ii) Postfix to infix
Q. 2 a) Write pseudo C++ code to represent Dequeue & perform following operations: 7M
i) Insert ii) delete iii) display
b) What is circular queue? Explain its advantage over linear queue. 6M
Q. 5 a) Implement an ascending priority queue and its operations. (Ref: R3 pg: 186) 7M
b) Develop an ADT for a priority queue. (Ref: R3 pg: 186) 6M
----------------------------------------------------------------Unit 6---------------------------------------------------------------
Q. 1 a) Implement sequential search in C++ using arrays and linked list. (Ref: R3 pg: 398) 6M
b) Write an algorithm for bubble sort with successive passes. (Ref: R3 pg: 350) 6M
Q. 2 a) Explain why the straight selection sort is more efficient than the bubble sort. (Ref: R3 pg: 364) 6M
b) Which of the following sort is most efficient? Why? (Ref: R3 pg: 373) 6M
i) Simple insertion
‘ ii) Straight selection sort
iii) Bubble Sort
Q. 3 a) Explain quick sort and sort the given list using it: 6M
15, 08, 20, -4, 16, 02, 01, 12, 21, -2
b) Write an algorithm for Fibonacci search and find its time complexity. 7M
Q. 4 a) Explain shell sort and sort given list using shell sort: 6M
08, 03, 02, 11, 05, 14, 00, 02, 09, 04, 20
b) Write short note on stability of sorting. Compare heap sort and quick sort with one example and discuss
time complexity. 7M
Q. 5 a) Compare Linear search and binary search. 6M
b) Write a pseudo C++ to sort list of integers using bubble sort. Sort following elements: 7M
10, 5, 4, 18, 17, 1, 2
Books:
Text:
T1. Brassard & Bratley, ―Fundamentals of Algorithmics, Prentice Hall India/Pearson Education,
ISBN 13-9788120311312.
T2. Horowitz and Sahani, ―Fundamentals of Data Structures in C++, University Press, ISBN 10:
0716782928 ISBN 13: 9780716782926.
T3. Goodrich, Tamassia, Goldwasser, ―Data Structures and Algorithms in C++, Wiley publication,
ISBN-978-81-265-1260-7
Reference:
R1. R. Gillberg, B. Forouzn, ―Data Structures: A Pseudo code approach with C, Cenage Learning,
ISBN 9788131503140.
R2. Horowitz, Sahani and Rajshekaran, ―Fundamentals of Computer Algorithms, University Press,
ISBN-13, 9788175152571.
R3. Yedidyah Langsam, Moshe J Augenstein, Aron M Tenenbaum, ―Data Structures using C and
C++, Pearson Education, ISBN 81-317-0328-2.
R4. A Michael Berman, ―Data Structures via C++: Objects by Evolution, Oxford University Press,
ISBN:0-19-510843-4.
R5. M. Weiss, ―Data Structures and Algorithm Analysis in C++‖, 2nd edition, Pearson Education,
2002, ISBN-81-7808-670-0.