ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Dequeue.h File Reference

The DEQUEUE (double ended queue) of exercise 4.9, a sequence changed at both ends, which is a STACK when used at one end and a QUEUE when used at both [see ADT.h]: realized with a LIST with pointers, every operation takes \( O( 1 ) \) time. More...

#include "ADS/Contract.h"
#include "ADS/sequence/List.h"
#include <cstddef>
#include "ADS/queue/impl/Dequeue.tpp"

Go to the source code of this file.

Classes

class  ADS::Dequeue< T >
 a DEQUEUE on a bidirectional list with pointers More...

Namespaces

namespace  ADS

Detailed description

The DEQUEUE (double ended queue) of exercise 4.9, a sequence changed at both ends, which is a STACK when used at one end and a QUEUE when used at both [see ADT.h]: realized with a LIST with pointers, every operation takes \( O( 1 ) \) time.

It is the structure of the algorithm of Pape-D'Esopo (section 11.8).

The contracts [see Contract.h]: removeHead(), removeTail(), head() and tail() need a dequeue that is not empty, and the insertions ensure one that is not. A removal copies the item, which the list reads before it removes its cell. The operations are defined in Dequeue.tpp.

See also
A. Montresor, Algoritmi e Strutture Dati, 2025, exercise 4.9, https://algoritmicamente.it/materiali/libro/capitoli/cap04.pdf
U. Pape, Implementation and efficiency of Moore-algorithms for the shortest route problem, Mathematical Programming 7(1), 212-222, 1974, doi:10.1007/BF01585517
Author
Donato Meoli
Dipartimento di Informatica
Università di Pisa