6

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 ...

Get C# Data Structures and Algorithms - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.