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

An ordered tree with cursors, beyond the book: the nodes in a vector, each with its value and the places of its parent, of its first child and of its next sibling, NIL if missing, as the Tree with pointers [see Tree.h] but with indices. More...

#include "ADS/Contract.h"
#include "ADS/Iterators.h"
#include <cstddef>
#include <ranges>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
#include "ADS/tree/impl/CursorTree.tpp"

Go to the source code of this file.

Classes

class  ADS::CursorTree< T >
 an ordered tree on a vector of nodes linked by their places More...
struct  ADS::CursorTree< T >::Used
 the places in use, for SlotIterator More...
struct  ADS::CursorTree< T >::Siblings
 the walk of the children of a node More...

Namespaces

namespace  ADS

Detailed description

An ordered tree with cursors, beyond the book: the nodes in a vector, each with its value and the places of its parent, of its first child and of its next sibling, NIL if missing, as the Tree with pointers [see Tree.h] but with indices.

A removed subtree returns its places to a free list. insertChild() and insertSibling() hang a new node, insertChildTree() and insertSiblingTree() a copy of a subtree of another tree, as first child or as next sibling; the visits are those of the book.

The contracts [see Contract.h]: a node is a used place, a sibling is inserted next to a node that is not the root, and the subtree copied is a node of the other tree; the invariant is that the nodes reached from the root link back to their parent and are all the nodes. The operations are defined in CursorTree.tpp.

See also
A. Montresor, Algoritmi e Strutture Dati, 2025, sections 5.1-5.3, https://algoritmicamente.it/materiali/libro/capitoli/cap05.pdf
Author
Donato Meoli
Dipartimento di Informatica
Università di Pisa