DSA Assignment (1)
DSA Assignment (1)
Assignment No. 1
Subject Name: Data Structure and Applications Semester: 3rd Section: A / B
Subject Code: BCS304 Deadline for Submission: Thursday 21st Nov 2024
Faculty Name: Vishal Sathawane (Till 4:30 PM)
SET A Questions
Q1 Library Management System Using Linked List and Dynamic Memory Allocation
Objective:
Design a library management system that can manage a collection of books using a linked list. Each book
will have attributes such as title, author, and ISBN. This project will help you understand linked lists and
dynamic memory allocation in C programming.
Problem Statement:
Create a C program that allows the user to:
1. Add a new book to the library.
2. Delete a book from the library by ISBN.
3. Search for a book by title or author.
4. Display all books in the library.
Each of these operations will require dynamic memory allocation to create new nodes in a linked list, where
each node represents a book.
Data Structure Design:
Each book can be represented as a node in a singly linked list where each node has:
• title (string): The title of the book.
• author (string): The author's name.
• ISBN (integer): A unique identifier for the book.
• next (pointer): A pointer to the next book node in the list.
SET B Questions
Q1 Event Management System Using Queue and Dynamic Memory Allocation
The Event Management System is designed to manage participants in an event. It uses a Queue data
structure to handle participant registration in a FIFO (First-In, First-Out) order, with dynamic memory
allocation for flexible memory usage. This is ideal for situations like event registration or ticketing where
participants are processed in the order they registered.
Project Requirements
The system will:
1. Register participants by adding them to a queue.
2. Process participants by dequeuing them as they complete their event registration.
3. View the next participant in line.
4. Display all participants in the order they registered.
Each participant will have details such as:
• Name
• Age
• Registration Number
Data Structure Design
Each participant will be represented as a node in a linked list-based queue, where each node has:
• name (string): The participant's name.
• age (integer): The participant's age.
• registrationNumber (integer): Unique ID for each participant.
• next (pointer): A pointer to the next participant node in the queue.
Putting It All Together
1. Initialize Front and Rear Pointers: At the beginning, both front and rear are NULL, indicating an
empty queue.
2. Menu-Driven Interface in main:
o Implement a main function with a menu to allow users to:
▪ Enqueue a participant
▪ Dequeue (process) a participant
▪ Peek at the next participant
▪ Display all participants
3. Dynamic Memory Management: Free all dynamically allocated memory for each participant before
program termination.
Q2 Word Deletion from a Sentence
Write a C program that deletes all occurrences of a specified word from a sentence.
1. Input Requirements:
o Prompt the user to enter a sentence (SENT) and a word (WORD) to delete.
2. Operations:
o Delete Word: Write a function to search for WORD in SENT and remove each occurrence,
shifting the remaining characters in SENT to fill the gap.
o Edge Cases: If WORD does not exist in SENT, display a suitable message.
3. Function Design:
o Use separate functions to:
▪ Read the sentence and word from the user.
▪ Search for and delete all occurrences of WORD in SENT.
▪ Display the modified sentence or a message if no deletions were made.
SET C Questions
Q1 Student Record System with Circular Queue and Linked List
• Objective: Design a student record management system that can efficiently handle enrollments.
• Description: Use a Circular Queue for handling a registration queue, allowing efficient
management of students waiting for enrollment. For storing student information, use a Linked List.
• Key Requirements:
o Add students to the enrollment queue.
o Register students and add them to a linked list of enrolled students.
o Remove students from the registration queue after enrollment.
o Display enrolled students in the order they registered.
• Concepts Covered: Circular Queue, Linked List, Dynamic Memory Allocation, Queue operations,
Linked List operations.