A command–line simulation of a library system written in C, using advanced data structures such as AVL trees, max-heaps, linked lists and dynamic structures. The program supports book management, member activity tracking, recommendations, fast searching, and system statistics.
Books are indexed in an AVL balanced binary search tree, allowing efficient lookup by title in O(log n) time.
A max-heap stores the most popular books based on their average user rating. Supports:
- automatic updates after reviews
- retrieving the top-k highest-rated books
Tracks:
- number of loans
- number of reviews
- total rating activity
Allows listing the most active members.
Each genre maintains a doubly–linked list of books and supports multiple view and print operations.
The program can print aggregated library statistics such as:
- number of books
- number of members
- active loans
- average rating
All data structures (AVL tree, heap, lists) are safely deallocated on exit.
Use the provided Makefile:
makeThis produces an executable named:
library
Run the program by passing an input file that contains commands:
./library input.txtExample commands inside an input file:
M 1 "Alice"
B 101 1 "The Hobbit"
L 1 101
R 1 101 ok 9
F "The Hobbit"
TOP 3
AM
X
-
AVL Tree For fast title-based search and updates.
-
Max-Heap Stores pointers to the highest-rated books for recommendation queries.
-
Doubly Linked Lists Used for the books inside each genre.
-
Singly Linked Lists For member activities and loans.
-
Dynamic Arrays Used for handling book displays and sorted collections.
Giannis Zlatanos Library Simulation in C — Systems & Data Structures Project