Skip to content

Glossary: Data Structures and Algorithms

Set

Also written: sets

A hash map with keys and no values, so adding and testing `x in my_set` are O(1) on average. A `seen` set turns O(n²) duplicate and pair checks into one O(n) pass.

Where the book teaches it

Related terms

Hash mapHashablevisited set