0% found this document useful (0 votes)
18 views

Library Management System

The document outlines a Library Management System (LMS) implemented in C, utilizing data structures like linked lists for efficient book management and user tracking. It details the system's objectives, functionalities, and operations, including adding, deleting, checking out, and returning books, while emphasizing the advantages of using linked lists for dynamic memory allocation. The project aims to enhance library operations and serves as a foundation for future improvements such as GUI integration and database usage.

Uploaded by

balarammuni17
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Library Management System

The document outlines a Library Management System (LMS) implemented in C, utilizing data structures like linked lists for efficient book management and user tracking. It details the system's objectives, functionalities, and operations, including adding, deleting, checking out, and returning books, while emphasizing the advantages of using linked lists for dynamic memory allocation. The project aims to enhance library operations and serves as a foundation for future improvements such as GUI integration and database usage.

Uploaded by

balarammuni17
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

NIST UNIVERSITY

Institute Park, Pallur hills, BERHAMPUR , ODISHA – 761008


Subject: Data Structure Using C
Code: CSE-111

Semester: 02 Batch : 2024 Section: A


Student Name Roll Number

Aaa 11111

bbb 22222

Library Management System (LMS)


List of Component used: C Language with Data Structure concepts

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

Mini Project on Library Management System (LMS) using Page# 1


Contents

Sl# Title Page No


1 Abstract 3
2 Overview of Library Management System 4
3 Code 10
4 Output 17
5 Conclusion 21
6 References 22

Mini Project on Library Management System (LMS) using Page# 2


1. Abstract
A Library Management System (LMS) is a software application designed to automate and
streamline the management of library resources, including books, users, transactions, and
inventory. The primary objective of this system is to facilitate the efficient operation of a library
by enabling seamless management of books and user interactions. The LMS allows library staff
to perform essential functions such as adding, deleting, searching, and updating book records,
as well as managing user memberships, checking out books, and processing returns.

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.

The key functionalities of the LMS include:

 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.

Mini Project on Library Management System (LMS) using Page# 3


2. Overview of Library Management System
A Library Management System (LMS) is a software that helps manage and organize
books, users, and the overall process of lending and returning books in a library. It
keeps track of important data such as:

 Book information (ID, name, author, status)


 User information (name, ID, borrowed books)
 Lending transactions (checkout and return of books)

It can perform tasks like:

 Adding, removing, and searching for books.


 Checking out and returning books.
 Displaying the list of books available in the library.

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.

2. Data Structures Used in Library Management System

a. Linked List

A linked list is a linear data structure where elements (called nodes) are connected
using pointers. Each node contains:

 Data (book information in this case).


 A pointer/reference to the next node in the sequence.

Mini Project on Library Management System (LMS) using Page# 4


In the context of the Library Management System, we use a singly linked list where
each book is represented as a node, and each node points to the next book in the
library.

Why Use Linked List in LMS?

 Dynamic Memory Allocation: The library's collection of books may change in


size over time. A linked list dynamically allocates memory as needed, avoiding
the memory wastage associated with fixed-size arrays.
 Efficient Insertions/Deletions: With linked lists, it’s easier to add or remove
books. For example, inserting a new book at the beginning or middle of the list is
more efficient than with arrays.
 Flexibility: The list can grow or shrink without worrying about resizing, which can
be a limitation with arrays.

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)

A queue is a First-In, First-Out (FIFO) data structure. A queue could be used to


manage the waiting list for books that are currently checked out. When a book
becomes available, the next person in line (FIFO) is notified or allowed to borrow the
book.

3. Design of the Library Management System

The Library Management System typically involves several key components:

Mini Project on Library Management System (LMS) using Page# 5


 Books: Each book has an ID, name, author, and availability status (whether it's
available or checked out). In C, this can be represented using a struct
(structure).
 Users: The system may also manage user data, such as user IDs, names, and
the books they have checked out.
 Functions/Operations: These include:
o Adding a book: Insert a new book into the library's collection.
o Removing a book: Delete a book from the collection.
o Checking out a book: Mark a book as unavailable for other users.
o Returning a book: Mark a book as available again.
o Searching for a book: Find a book based on specific criteria such as
book ID, author, or title.

These operations will use different data structures to manage and perform these tasks
efficiently.

4. How the System Works in Detail

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.

b. Displaying All Books:

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.

c. Checking Out a Book:

Mini Project on Library Management System (LMS) using Page# 6


When a book is checked out, the system locates the book in the linked list by its unique
bookID. Once the book is found, the system changes its status to "checked out" (i.e.,
marking it as unavailable). This is done by modifying the available field of the book node
to 0.

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.

5. Operations Complexity Analysis

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:

Mini Project on Library Management System (LMS) using Page# 7


o Searching for the book by ID: O(n).
o Adjusting the pointers to delete the node is O(1), but this is done only after
finding the book.

6. Advantages and Disadvantages of the Linked List Approach

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:

 Searching Efficiency: Searching for a specific book in an unsorted list can be


slow (O(n)).
 Extra Memory Usage: Each node requires additional memory for storing the
pointer to the next node.

7. Enhancements and Future Improvements

Some possible improvements to the system could include:

 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.

Mini Project on Library Management System (LMS) using Page# 8


Features of the Library Management System:

1. Add a book to the library.


2. Display all books in the library.
3. Search for a book by its name or author.
4. Delete a book from the library.
5. Check out a book (mark it as unavailable).
6. Return a book (mark it as available again).

Approach:

 Use a Linked List to store the books in the library.


 Each node of the linked list will represent a book, and each book will have:
o Book ID
o Book Name
o Author Name
o Availability status (whether the book is available or checked out)

Mini Project on Library Management System (LMS) using Page# 9


3. CODE
#include <stdio.h>

#include <stdlib.h>

#include <string.h>

typedef struct Book {

int bookID;

char bookName[100];

char authorName[100];

int available; // 1 for available, 0 for not available

struct Book* next;

} Book;

Book* head = NULL;

void addBook(int id, char* name, char* author) {

Book* newBook = (Book*)malloc(sizeof(Book));

newBook->bookID = id;

strcpy(newBook->bookName, name);

strcpy(newBook->authorName, author);

newBook->available = 1; // New books are available by default

newBook->next = NULL;

if (head == NULL) {

head = newBook;

Mini Project on Library Management System (LMS) using Page# 10


} else {

Book* temp = head;

while (temp->next != NULL) {

temp = temp->next;

temp->next = newBook;

void displayBooks() {

if (head == NULL) {

printf("No books available in the library.\n");

return;

Book* temp = head;

printf("Books in the library:\n");

while (temp != NULL) {

printf("ID: %d, Name: %s, Author: %s, Status: %s\n", temp-


>bookID, temp->bookName, temp->authorName, temp->available ?
"Available" : "Checked out");

temp = temp->next;

Book* searchBook(int id) {

Book* temp = head;

Mini Project on Library Management System (LMS) using Page# 11


while (temp != NULL) {

if (temp->bookID == id) {

return temp;

temp = temp->next;

return NULL;

void checkoutBook(int id) {

Book* book = searchBook(id);

if (book != NULL) {

if (book->available) {

book->available = 0;

printf("Book '%s' has been checked out.\n", book-


>bookName);

} else {

printf("Book '%s' is already checked out.\n", book-


>bookName);

} else {

printf("Book with ID %d not found.\n", id);

void returnBook(int id) {

Book* book = searchBook(id);

Mini Project on Library Management System (LMS) using Page# 12


if (book != NULL) {

if (!book->available) {

book->available = 1;

printf("Book '%s' has been returned.\n", book->bookName);

} else {

printf("Book '%s' is already available in the library.\n",


book->bookName);

} else {

printf("Book with ID %d not found.\n", id);

void deleteBook(int id) {

Book* temp = head;

Book* prev = NULL;

if (temp != NULL && temp->bookID == id) {

head = temp->next;

free(temp);

printf("Book with ID %d has been deleted.\n", id);

return;

while (temp != NULL && temp->bookID != id) {

prev = temp;

temp = temp->next;

Mini Project on Library Management System (LMS) using Page# 13


}

if (temp == NULL) {

printf("Book with ID %d not found.\n", id);

return;

prev->next = temp->next;

free(temp);

printf("Book with ID %d has been deleted.\n", id);

int main() {

int choice, id;

char name[100], author[100];

while (1) {

printf("\nLibrary Management System\n");

printf("1. Add Book\n");

printf("2. Display Books\n");

printf("3. Checkout Book\n");

printf("4. Return Book\n");

printf("5. Delete Book\n");

printf("6. Exit\n");

printf("Enter your choice: ");

scanf("%d", &choice);

Mini Project on Library Management System (LMS) using Page# 14


switch (choice) {

case 1:

printf("Enter book ID: ");

scanf("%d", &id);

printf("Enter book name: ");

getchar(); // To consume newline character left by


previous scanf

fgets(name, sizeof(name), stdin);

name[strcspn(name, "\n")] = '\0'; // Remove trailing


newline character

printf("Enter author name: ");

fgets(author, sizeof(author), stdin);

author[strcspn(author, "\n")] = '\0'; // Remove


trailing newline character

addBook(id, name, author);

break;

case 2:

displayBooks();

break;

case 3:

printf("Enter book ID to checkout: ");

scanf("%d", &id);

checkoutBook(id);

break;

case 4:

printf("Enter book ID to return: ");

Mini Project on Library Management System (LMS) using Page# 15


scanf("%d", &id);

returnBook(id);

break;

case 5:

printf("Enter book ID to delete: ");

scanf("%d", &id);

deleteBook(id);

break;

case 6:

printf("Exiting...\n");

exit(0);

default:

printf("Invalid choice, please try again.\n");

return 0;

Mini Project on Library Management System (LMS) using Page# 16


4.Output

Mini Project on Library Management System (LMS) using Page# 17


Mini Project on Library Management System (LMS) using Page# 18
Mini Project on Library Management System (LMS) using Page# 19
Mini Project on Library Management System (LMS) using Page# 20
5.Conclusion
In conclusion, the Library Management System (LMS) is a valuable tool for automating and
streamlining the day-to-day operations of a library. By utilizing data structures like linked lists,
the system ensures efficient management of books and user data, while optimizing memory
usage and processing time. The system enhances the efficiency of tasks such as adding,
deleting, searching, and checking out books, contributing to better organization and resource
management. Ultimately, the LMS provides a scalable, user-friendly solution that can be further
expanded to incorporate advanced features like online access, reports, and more, supporting
the future growth of library systems.

Mini Project on Library Management System (LMS) using Page# 21


6. References
Books:
1. Seymour, G. P. (2013). Data Structures and Algorithms in C (2nd ed.). Prentice Hall.
o This book provides a solid foundation on data structures and algorithms,
including linked lists, which can be useful for implementing the library
management system.
2. Reed, S. (2004). Practical C Programming (3rd ed.). O'Reilly Media.
o A great book on C programming, providing in-depth explanations on the C
language, which will be helpful for implementing your library system in C.
3. Weiss, M. A. (2013). Data Structures and Algorithm Analysis in C (4th ed.). Pearson.
o This book covers data structures and algorithm analysis with a focus on C
programming, which can help you with understanding linked lists and other data
structures for your project.

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.

Research Papers and Journals (for advanced or theoretical concepts):


1. Al-Hawari, S. (2018). Library Management System: A Case Study of the University
Library. International Journal of Computer Science and Information Security, 16(12), 82-
88.
o A research paper on how library management systems are structured and the
technologies involved in their design and implementation.
2. Thapliyal, K. (2014). Library Automation: A Guide to Implementation of Library
Management Systems. Library Review, 63(8), 502-512.

Mini Project on Library Management System (LMS) using Page# 22


o This paper covers library automation systems, which may provide additional
insight into the practical applications of library management systems.

Mini Project on Library Management System (LMS) using Page# 23

You might also like