File QueueAlgorithms.h

↰ Parent directory (ADS/queue)

Algorithms that use a QUEUE [see File ADT.h] only through its operations, beyond the book:

Definition (ADS/queue/QueueAlgorithms.h)

Detailed Description

  • extractPositive() moves the positive items of q, in their order, to the back of another queue, and leaves q empty, in O( n );

  • copyPositive() does the same but leaves q as it was, by moving each item to an auxiliary queue and then back.

The contracts [see File Contract.h]: the two queues are distinct objects, and copyPositive() ensures that q is left as it was (an audit). The algorithms are defined in QueueAlgorithms.tpp.

  1. Montresor, Algoritmi e Strutture Dati, 2025, section 4.3, https://algoritmicamente.it/materiali/libro/capitoli/cap04.pdf

Donato Meoli

Dipartimento di Informatica Universita’ di Pisa

by Donato Meoli

Includes

Namespaces

Functions