Dictionaries and Sets
This chapter focuses on data structures related to dictionaries and sets. Applying these data structures makes it possible to map keys to values and perform fast lookup, as well as to make various operations on sets. To simplify your understanding of dictionaries and sets, this chapter contains illustrations and code snippets, along with detailed descriptions.
First, you will learn about both non-generic and generic versions of a dictionary, which is a collection of pairs, each consisting of a key and a value. Then, a sorted variant of a dictionary will be presented. The remaining part of this chapter will show you how to use hash sets, together with a “sorted” set variant. Is it possible to have a “sorted” set? You’ll learn more later in this chapter.
In this chapter, the following topics will be covered:
- Hash tables
- Dictionaries
- Sorted dictionaries
- Hash sets
- “Sorted” sets