# Data Structures and Applications – 17CS33 Question Bank 2

## Data Structures and Applications – 17CS33 Question Bank 2

### Module 3 – Linked Lists

1. Assume a list exists. Read two numbers M and N from the list and swap them.

2. Write a function to reverse a singly linked list.

3. Write a function to print an ordered list. (The list should sort and as and when the elements are entered)

4. Write a function to concatenate two lists.

5. Write a function to display nodes of a DLL in reverse order.

6. Write a function to delete all nodes in SLL and DLL.

7. Give differences between SLL and DLL

8. Explain in detail the merits and demerits of linked lists

9. Distinguish arrays and linked lists.

10. Explain the advantages of circular lists with respect to other lists.

11. What is the use of header node in a list? Explain with examples.

12. Write all four functions to implement circular DLL using the header.

13. Describe DLL with advantages and disadvantages. Write C function to delete a node from DLL, ptr is a pointer which points to the node to be deleted. Assume that there are nodes on either side of the node to be deleted.

14. Demonstrate queue and stack using singly linked list  Or Explain how a chain can be used to implement a queue. Write the functions to insert and delete elements from such a queue.

15. Write functions for the following to (a) find the length of the list (b). display odd and even numbers in the list (c). add odd & even numbers in the list (d). To search a given node in the list.

16. Create SLL of integers and write C functions to perform the following,

a. Create a node list with data 10,20 and 30

b. Insert a node with value 15 in between 10 and 20

c. Delete the node whose data is 20

d. Display the resulting SLL

17. Write operations for SSL, DLL CSLL & CDLL

a. Insertfront() b. InsertEnd() c. Insert_Bef_Key d. Insert_aft_Key() e. Del_front() f. Del_End() g. Del_Key()

18. Write operations for CSLL & CDLL a. Insertfront() b. InsertEnd() e. Del_front() f. Del_End()

19. Consider two polynomials A(x) = 2×1000 + 1 and B(x) = x4 + 10×3 + 3×2 +1, show diagrammatically how these two polynomials can be stored in a single 1-D array. Also, give its C representation.

20. What is a polynomial? What is the degree of a polynomial? Write a function to add two polynomial.

21. Explain different types of a linked list with the neat diagram.

22. With node structure show how would you store the polynomials in a linked list? Write C functions for adding two polynomials represented as circular lists.

23. Write a short note on a linked representation of sparse matrix and DLL.