Library Management System
Library Management System
Aaa 11111
bbb 22222
Abstract: The Library Management System (LMS) is a software solution designed to automate library
operations, including book management, user tracking, and transaction processing. It leverages data
structures such as linked lists to efficiently store and manage book records dynamically. The system
allows users to add, delete, search, check out, and return books, with real-time updates on book
availability. By utilizing linked lists, the system ensures efficient memory usage and operations such as
insertion, deletion, and searching. The LMS improves the efficiency of library management, offering a
scalable solution for tracking resources and users in a structured manner.
Objective: The objective of the Library Management System (LMS) is to automate library operations,
efficiently manage book records and user transactions, and provide an intuitive interface for seamless
book tracking and management.
Circuit diagram/Diagram: NO
Outcome/Result: YES. Screenshots given
Picture/Image/Simulation Result: Yes. C Compiled code output screens
Name of the Professor: Ch Sree Kumar
Sec: A
Marks obtained out of 100
This system is implemented using data structures in C programming, utilizing concepts such
as linked lists for dynamic book storage and management. Each book is represented as a
node in a linked list, which allows for efficient insertion, deletion, and search operations. The
system is menu-driven, providing an intuitive user interface to interact with various library
operations, such as searching for books by ID or name, checking out available books, and
viewing a list of all books in the library.
Book Management: Add, delete, and search for books based on different criteria.
User Management: Track library users and their borrowed books.
Transaction Handling: Manage the checkout and return of books, updating the
availability status in real-time.
Dynamic Data Storage: Using linked lists for storing and managing books dynamically
without wasting memory.
The implementation of the Library Management System demonstrates the importance of data
structures in handling real-world problems effectively. By using linked lists, the system allows
for flexible and efficient management of library resources, ensuring that books can be easily
added, removed, or modified. This project not only enhances the operational efficiency of the
library but also provides a foundation for the development of more advanced systems with
features such as online access, cataloging, and detailed reporting.
A Data Structure is used to organize and store this data efficiently for quick retrieval
and manipulation. In C programming, the primary data structures often used in such
systems are arrays, linked lists, stacks, and queues.
a. Linked List
A linked list is a linear data structure where elements (called nodes) are connected
using pointers. Each node contains:
b. Stacks (Optional)
A stack is a Last-In, First-Out (LIFO) data structure. The stack follows the push (add
an element) and pop (remove the top element) operations.
In a library system, stacks can be used to implement the undo feature or to track
recent transactions, such as checking out a book. After a book is checked out, you
can push the operation to a stack. If the user wants to undo the operation, the system
can pop the last operation.
c. Queues (Optional)
These operations will use different data structures to manage and perform these tasks
efficiently.
a. Adding a Book:
When a new book is added, the system will create a new node in the linked list. This
node contains information about the book (ID, name, author, availability). The new node
is appended to the list. If it's the first book, the head of the linked list is initialized to point
to this node.
To display all books, the system traverses the linked list, starting from the head, and
prints the details of each book. It will also check the availability of each book to indicate
whether the book is available for checkout or already checked out.
d. Returning a Book:
When a book is returned, the system again searches for the book and changes its
status back to "available". The available field is updated to 1.
e. Deleting a Book:
To delete a book, the system searches for the book by its ID. Once found, the system
removes it from the linked list by adjusting the pointers. If the book is at the head of the
list, the head pointer is updated to point to the next book.
Let’s analyze the time complexity of some key operations in the Library Management
System.
1. Adding a book:
o Inserting a book at the end of the linked list: O(n), where n is the number
of books in the library. This is because the system must traverse the list to
find the last node.
o If the list is sorted or if a pointer to the last node is maintained, insertion
can be done in O(1) time.
2. Searching for a book:
o To find a book by ID, we must traverse the entire list, so the time
complexity is O(n).
3. Checking out/Returning a book:
o Searching for the book by ID: O(n).
o Once the book is found, updating its status is O(1).
4. Deleting a book:
Advantages:
Dynamic Size: The library’s collection of books can grow or shrink as needed.
Efficient Memory Usage: Memory is allocated as needed, avoiding the wasted
space associated with static arrays.
Efficient Insertions/Deletions: Adding or removing books from the library is
efficient, especially when handling frequent changes in the collection.
Disadvantages:
Sorting: The linked list could be sorted by book name or author to speed up
searches.
Hash Tables: For faster searches, hash tables could be used, where each book
ID is hashed to an index for quicker lookup.
GUI/Database: A graphical user interface (GUI) could be added for better
interaction, or a database (like SQLite) could be used for persistent storage of
books and users.
Approach:
#include <stdlib.h>
#include <string.h>
int bookID;
char bookName[100];
char authorName[100];
} Book;
newBook->bookID = id;
strcpy(newBook->bookName, name);
strcpy(newBook->authorName, author);
newBook->next = NULL;
if (head == NULL) {
head = newBook;
temp = temp->next;
temp->next = newBook;
void displayBooks() {
if (head == NULL) {
return;
temp = temp->next;
if (temp->bookID == id) {
return temp;
temp = temp->next;
return NULL;
if (book != NULL) {
if (book->available) {
book->available = 0;
} else {
} else {
if (!book->available) {
book->available = 1;
} else {
} else {
head = temp->next;
free(temp);
return;
prev = temp;
temp = temp->next;
if (temp == NULL) {
return;
prev->next = temp->next;
free(temp);
int main() {
while (1) {
printf("6. Exit\n");
scanf("%d", &choice);
case 1:
scanf("%d", &id);
break;
case 2:
displayBooks();
break;
case 3:
scanf("%d", &id);
checkoutBook(id);
break;
case 4:
returnBook(id);
break;
case 5:
scanf("%d", &id);
deleteBook(id);
break;
case 6:
printf("Exiting...\n");
exit(0);
default:
return 0;
Websites:
1. GeeksforGeeks. (n.d.). Linked List in C. Retrieved from
https://www.geeksforgeeks.org/data-structures/linked-list/
o This website provides tutorials on how to implement and work with linked lists in
C, which will be crucial for your library management system.
2. TutorialsPoint. (n.d.). C Programming Language. Retrieved from
https://www.tutorialspoint.com/cprogramming/
o A useful online resource for understanding C programming concepts and syntax.
The tutorials on C programming can guide you through the process of writing and
compiling your system.
3. Programiz. (n.d.). C Programming - Introduction. Retrieved from
https://www.programiz.com/c-programming
o Programiz offers tutorials and examples in C, which could assist you in
understanding basic C syntax and how to apply it in your library management
system.
4. Stack Overflow. (n.d.). C linked list operations. Retrieved from
https://stackoverflow.com/questions/tagged/c-linked-list
o A helpful community-driven Q&A site where you can get solutions and advice on
issues related to C programming and linked list implementation.
5. W3Schools. (n.d.). C Data Structures. Retrieved from
https://www.w3schools.com/c/c_data_structures.asp
o W3Schools provides easy-to-understand explanations of data structures in C,
which can be referenced when working with data structures like arrays, linked
lists, and stacks for your project.