Skip to content

Books and reservations managment using Red Black Trees and Min Binary Heaps for my Advanced Data Structures Course.

Notifications You must be signed in to change notification settings

drone911/GatorLibrary

Repository files navigation

Project Overview

  • The Gator Library Management System is designed to efficiently manage books and their reservations.
  • It is written in C++ which runs natively and also provides a granular control over memory.
  • To manage the books we implement a Red Black Tree. Each node in the tree is a key-value pair (bookId, BookData).
  • Bookdata consists of book name, author name, availability, borrowed by, and reservations.
  • Also, reservations are a priority queue implemented using Binary Min heaps.

Project Structure

  • Main.cpp
    • Main controls the overall run of the program.
    • It creates the instance of our library class GatorLibrary.
    • It reads commands in the input file, parses them, and calls appropriate functions on the library instance.
    • Furthermore, it manages the output file. It changes the cout buffer to point to the output file buffer, and thus the library instance writes to a file and not the standard output.
  • GatorLibrary.h & GatorLibrary.cpp:
    • The GatorLibrary class is defined here that stores books using RB tree.
    • The GatorLibrary Class implements our business logic comprising function such as insertBook, printBook, borrowBook, returnBook, etc.
    • It also implements private functions to rebalance the tree after inserts or deletes, rotate nodes, print Nodes, check parents Nodes, etc.
    • Structures that abstract a Red Black Tree Node (named BookNode) and the data about a book (named BookData) are also defined here.
  • Reservations.h & Reservations.cpp:
    • The Reservations class is defined here that stores Reservations using Min-Binary heap.
    • The Reservations class implements our business logic for inserting new reservations and popping the highest priority reservations.
    • It also implements private functions to heapify the heap again after inserts and deletes.
    • A structure to hold a reservation (named Reservation) and a function to compare two reservations are also defined

How to use

  • Run make or make all to build the executable gatorLibrary.
  • Run make test to run automated test cases in present in the folder tests.
  • Run make clean to remove the executable gatorLibrary and delete outputs generated during tests.

About

Books and reservations managment using Red Black Trees and Min Binary Heaps for my Advanced Data Structures Course.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published