A console-based parcel delivery management system in C++ demonstrating four core algorithms from the algorithms/DSA curriculum. Features role-based access for admins, delivery staff, and customers, with full file persistence across sessions.
| Algorithm | Where Used | Complexity |
|---|---|---|
| Merge Sort | Sort parcels by delivery distance | O(n log n) |
| Greedy / EDF | Earliest-Deadline-First scheduling & auto-assignment | O(n log n) |
| 0/1 Knapsack DP | Max-weight optimization within vehicle capacity | O(n × W) |
| Priority Queue | Urgency-based dispatch ordering | O(n log n) |
Admin
- Add/delete parcels and staff (with duplicate ID guard)
- Manually assign staff to parcels, or auto-assign via Greedy EDF
- Sort parcel list by distance using Merge Sort
- Run Priority Dispatch Queue to see urgency-ranked delivery order
- Run 0/1 Knapsack to find optimal parcel set for a given vehicle capacity
- Search parcels by sender, receiver, or status (case-insensitive)
- Analytics report: delivery rate, average distance, heaviest parcel, busiest staff
Delivery Staff
- View only parcels assigned to their Staff ID
- Update parcel status with timestamped history log
Customer / User
- Track any parcel by ID with full status history
- Cancel a parcel (only if still in "Booked" state)
Requirements: C++11 or later
g++ -std=c++11 -o parcel parcel_delivery.cpp
./parcelNo external libraries required.
========================================================================
PARCEL DELIVERY OPTIMIZER
Algorithms Course Project — IIUC
========================================================================
[1] Admin Login
[2] Delivery Staff Login
[3] User / Customer Access
[0] Exit
ANALYTICS REPORT
========================================================================
Total Parcels : 5
Delivered : 2 (40%)
In Transit : 1
Booked / Pending : 2
Assigned to Staff : 4
------------------------------------------------------------------------
Avg Distance : 18 km
Total Weight : 21 kg
Heaviest Parcel : #3 (7 kg)
------------------------------------------------------------------------
Staff Count : 2
Busiest Staff : Rafi (3 parcels)
========================================================================
New Parcels Added
│
▼
┌─────────────────────┐ Sort list by distance
│ Merge Sort │ ──► O(n log n) — stable sort
└─────────────────────┘
│
▼
┌─────────────────────┐ Which parcels fit in the vehicle today?
│ 0/1 Knapsack DP │ ──► Maximize weight within capacity
└─────────────────────┘
│
▼
┌─────────────────────┐ Assign staff to selected parcels
│ Greedy EDF │ ──► Earliest deadline gets assigned first
└─────────────────────┘
│
▼
┌─────────────────────┐ Final dispatch order for drivers
│ Priority Queue │ ──► Urgency = deadline × 2 + distance
└─────────────────────┘
Data is saved automatically after every write operation:
| File | Contents |
|---|---|
parcels.txt |
All parcel records + next ID counter |
staff.txt |
Staff records with assignment counts |
Both files are pipe-delimited, human-readable. Add them to .gitignore — they're runtime data.
# .gitignore
parcels.txt
staff.txt
*.exe
*.out
*.o
parcel-delivery-optimizer/
├── parcel_delivery.cpp # All source — ~600 lines
├── .gitignore
└── README.md
- No authentication — staff login is by ID only, no password
- Urgency score formula is heuristic; not derived from a formal scheduling model
- Status history stored as a flat string; a proper log would use a separate file or linked list
- File parser assumes no
|characters in names — enforced by replacing|with;in history strings
Asliraf Samaylan — IIUC, CSE
Algorithms / DSA Lab Course Project