Author: Divyam Dubey
The Gator Ticket Master system streamlines seat reservations for Gator events, automating processes like seat allocation, cancellations, and waitlist management. The system:
- Manages seat reservations dynamically, adding seats as demand increases.
- Prioritizes users on the waitlist based on priority and earliest request timestamps.
- Cancels reservations and efficiently reallocates seats.
- Detects and handles unusual activity with administrative seat releases.
- Seat Assignment: Allocates seats in ascending order.
- Waitlist Management: Maintains a priority-based waitlist for users.
- Dynamic Seat Allocation: Adds seats dynamically based on demand.
- Admin Control: Supports bulk seat releases in cases of unusual activity.
gatorTicketMaster.py: Handles user interactions and implements core functions.BinaryHeap.py: Manages unassigned seat IDs.RedBlackTree.py: Tracks active reservations efficiently.WaitlistMaxBinaryHeap.py: Manages the priority-based waitlist.
Initialize(seatCount: int): Sets up the initial seating arrangement.Reserve(userId: int, userPriority: int): Reserves a seat or adds the user to the waitlist.Cancel(seatId: int, userId: int): Cancels a reservation and reassigns the seat if needed.Available(): Displays current seat availability and waitlist status.ExitWaitlist(userId: int): Removes a user from the waitlist.UpdatePriority(userId: int, userPriority: int): Updates a user’s priority in the waitlist.AddSeats(count: int): Adds new seats to the system and assigns them to waitlisted users.PrintReservations(): Lists all current reservations.ReleaseSeats(userId1: int, userId2: int): Cancels reservations within a range of user IDs.Quit(): Ends the program execution.
- Purpose: Stores unassigned seats.
- Complexity: O(log n) for insertions and minimum extraction.
- Key Methods:
insert(item)extract_min()remove_arbitrary(item)
- Purpose: Manages active reservations.
- Complexity: O(log n) for search, insertion, and deletion.
- Key Methods:
insert(key, seatId)delete(key)search(key)inorder_traversal()
- Purpose: Manages the waitlist with priority-based ordering.
- Complexity: O(log n) for insertions and maximum extraction.
- Key Methods:
insert(userId, priority, timestamp)extract_max()update_priority(userId, new_priority)remove_user(userId)
- Input Processing: Reads commands from an input file and executes corresponding functions.
- Seat Management: Tracks unassigned and reserved seats using the Binary Heap and Red-Black Tree.
- Waitlist Management: Handles user priorities and timestamps with a Max Binary Heap.
- Output Generation: Writes operation results to an output file.
- Binary Heap (Min Heap): Efficiently assigns the lowest available seat.
- Red-Black Tree: Ensures fast operations for reservation management.
- Max Binary Heap: Prioritizes waitlisted users based on priority and timestamps.
- Dynamic Seat Addition: Adds new seats and assigns them to waitlisted users.
- Timestamp Usage: Ensures fairness for users with equal priority.
- Batch Seat Release: Handles bulk cancellations or administrative actions.
| Operation | Complexity |
|---|---|
Initialize |
O(n log n) |
Reserve |
O(log n) |
Cancel |
O(log n) |
Available |
O(1) |
ExitWaitlist |
O(log n) |
UpdatePriority |
O(log n) |
AddSeats |
O(m log n) |
PrintReservations |
O(n) |
ReleaseSeats |
O((k + m) log n) |
- Binary Heap: Unassigned seats.
- Red-Black Tree: Active reservations.
- Max Binary Heap: Waitlist.
Overall: O(n), where n is the total number of seats.
- Run the program using the Python interpreter.
- Input commands via a file to initialize and interact with the system.
- Optimized for large-scale events using efficient data structures.
- Designed for dynamic seat additions and priority updates.
- Validates inputs to prevent invalid operations.
- Handles edge cases like non-existent reservations and updates for non-waitlisted users.