# Sets and Dictionaries at Work

The dictionaries and sets your language already has, how to use your own objects as keys without a hidden bug, and hash tables at work: caches, counting and removing duplicates.

Updated: November 17, 2026

## [In Your Language](https://www.ask-codey.com/courses/data-structures/topics/ds-in-your-language)

1. [The Front Desk Finds You in One Scan: Dictionaries](https://www.ask-codey.com/lessons/ds-dictionaries) (Apprentice): Find any of a gym's 2,000 members in one step, 600 times an hour, with the dictionary your language already has: add, read, update and remove entries, read a missing key safely, and know when not to count on its order.
2. [Have I Seen This Before? Sets](https://www.ask-codey.com/lessons/ds-sets) (Apprentice): Count the different members who came to the gym today, and know at each scan whether it's someone's first visit: why counting scans, a list and a dictionary of "true" each fall short, and how your language's set answers "have I seen this before?" in one step.

## [Using Them Well](https://www.ask-codey.com/courses/data-structures/topics/ds-using-them-well)

1. [Why Can't the Dictionary Find Card 1042? Good Keys](https://www.ask-codey.com/lessons/ds-good-keys) (Journeyman): Find a member's locker from the card scanned this morning, when both of the gym's branches have a member 1042: why the card object, the member number alone and equality on its own each fail, and how to make your own type a key that works in your language.
2. [When a Loop Inside a Loop Is Too Slow: Hash Tables at Work](https://www.ask-codey.com/lessons/ds-hash-tables-at-work) (Journeyman): Turn the gym's slow year-end reports into one pass: count each member's visits, find the first member to come back, and stop asking a slow server the same question twice. Then choose a list, a set or a dictionary for a job, and say why.

## [Exercise: The Word Counter](https://www.ask-codey.com/courses/data-structures/topics/exercise-ds-word-counter)

1. [Exercise: The Word Counter](https://www.ask-codey.com/lessons/exercise-ds-word-counter) (Apprentice): A year of the gym's member comments, 300,000 words, and a report that has to finish in under 2 seconds: count every word, list the ten members use most, and find the words used only once. The tests check it on a short story and on a full year.

Source: https://www.ask-codey.com/courses/data-structures/chapters/ds-sets-and-dictionaries
