Context
This project was the final project for the course entitled "Data Structures and Algorithms" during the first semester of 2021 (second year).
Description and goals
The goal of this project was to show understanding of different data structures, sorting algorithms and advanced concepts.
The project was about finding an appointment of a certain duration for some employees from their calendars and availabilities.
The main features of the console application were:
- Search an employee
- Add a new employee
- Remove an employee
- Add a new meeting
- Cancel a meeting
- Delete all meetings before a certain date
- Suggest best time to meet
Tech Stack
C++
Concepts used and developped
- Pointers
- Data Structures (e.g., linked lists, doubly linked lists, etc)
struct- File I/O
Implementation
Main
The program's main function features a do while loop with a switch block. This block evaluates the user's input to select one of the modes shown in the goals section. This was before OOP and even in the beginning of my coding career, so I would change how I do things if I ever came back to this project.
Employees
Employee data is saved in a file in the same directory as the running programme. It is read and updated when save is requested. When placed into memory, employees are saved in a linked list of a custom struct.
Meetings
- Meetings' attendees are checked if they exist in the system before being added
- Adding a meeting will add it to all of its attendees' calendars
- Removing a meeting will remove it from all of its attendees' calendars
N.B. The meetings list, or the employees' calendars are also a linked list
Meetings suggestion
This feature is the most important feature in this project.
The algorithm goes as following:
- Parse the calendar of each employee, and store the available time slots in an array
- Get the available time slots for each employee:
- at the beginning:
- start time = 1, 0:0:0
- end time = start time of first meeting
- at the end:
- start time = start time of last meeting + duration
- end time = 365, 23:59:59
- elsewhere:
- start time = start time of last meeting + duration
- end time = start time of next meeting
- at the beginning:
- If time difference >= minTime, add node to the list. The list is automatically sorted since the calendars are.
- When done, use an array of
AvTimeto store pointers to each array containing available time of attendees - Compare available times using those pointers and find intersection
- start = highest starting time of all pointers
- end = lowest end time of all pointers
- if pointer's end time == end time of intersection, move pointer to the next node, else, stay on same node