File LinkedHashSet.h

↰ Parent directory (ADS/set)

The SET on a hash table whose foreach follows the order of insertion (exercise 8.9): a LIST keeps the items in that order and the table maps each item to its position, so insert(), remove() and contains() take O( 1 ) expected time and forEach() O( n ).

Definition (ADS/set/LinkedHashSet.h)

Detailed Description

The contracts [see File Contract.h]: after insert() the item is there and after remove() it is not; the invariant is that each item of the list is indexed at its own position and the table has no other item. The operations are defined in LinkedHashSet.tpp.

  1. Montresor, Algoritmi e Strutture Dati, 2025, exercise 8.9, https://algoritmicamente.it/materiali/libro/capitoli/cap08.pdf

Donato Meoli

Dipartimento di Informatica Universita’ di Pisa

by Donato Meoli

Includes

Namespaces

Classes