O'Reilly logo

C# Data Structures and Algorithms by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example – swimming pools

This example presents the system for a SPA center with four swimming pools, namely recreation, competition, thermal, and for kids. Each visitor receives a special wrist band that allows one to enter all the pools. However, it is necessary to scan the wrist band while entering any pool and your program can use such data for creating various statistics.

In this example, the hash set is chosen as a data structure for storing unique numbers of wrist bands that have been scanned in the entrance to each swimming pool. Four sets will be used, one per each pool, as shown in the following diagram. Moreover, they will be grouped in the dictionary to simplify and shorten the code, as well as make future modifications easier: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required