Imagine a restaurant with a big round table surrounded by n seats. The FancySeatManager is an algorithm that determines if there are enough contiguous seats for a group of x people and always selects the most efficient seat for them so that the restaurant owner can accommodate as many guests as possible.
I implemented this algorithm in C# as a console application and aswell in JavaScript with a neat visualization of the seats and groups.
It was a nice programming exercise and an interesting comparison of these two programming languages and the usage of the different implementation options.
- setting a number of n seats
- adding a group of x people
- auto generated incremental group-id
- remove a group with the corresponding group-id
- notification when group is set or no more space is available
main view | create 20 seats |
adding a group of 3 people | not enough space anymore |
remove group with the id 2 | |
create 10 seats | adding a group of 3 people |
remove group with the id 2 | |