Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
Loading...
Searching...
No Matches
Data Structures | Functions
dsac::tree Namespace Reference

Code from the chapter "Trees". More...

Data Structures

class  LinkedBinaryTree
 

Functions

template<typename Position , typename Container >
void inorder (Position p, Container &visited)
 
template<typename Position >
void print_preorder_indent (Position p, int d=0)
 Prints preorder representation of subtree rooted at p having depth d.
 
template<typename Position >
void print_preorder_labeled (Position p, std::vector< int > &path)
 Prints labeled representation of subtree rooted at p having depth d.
 
template<typename Position >
void parenthesize (Position p)
 Prints parenthesized representation of subtree rooted at p.
 
template<typename Position >
int disk_space (Position p)
 Returns total disk space of elements stored in subtree rooted at p.
 
template<typename Position >
int layout (Position p, int d, int x)
 
template<typename Position >
int depth (Position p)
 returns the number of proper ancestors of p
 
template<typename Tree >
int height_bad (const Tree &t)
 
template<typename Position >
int height (Position p)
 
template<typename Position , typename Container >
void preorder (Position p, Container &visited)
 
template<typename Position , typename Container >
void postorder (Position p, Container &visited)
 
template<typename Position >
std::queue< Position > breadthfirst (Position p)
 

Detailed Description

Code from the chapter "Trees".

Function Documentation

◆ breadthfirst()

template<typename Position >
std::queue< Position > dsac::tree::breadthfirst ( Position  p)

◆ depth()

template<typename Position >
int dsac::tree::depth ( Position  p)

returns the number of proper ancestors of p

Here is the call graph for this function:

◆ disk_space()

template<typename Position >
int dsac::tree::disk_space ( Position  p)

Returns total disk space of elements stored in subtree rooted at p.

Here is the call graph for this function:

◆ height()

template<typename Position >
int dsac::tree::height ( Position  p)
Here is the call graph for this function:

◆ height_bad()

template<typename Tree >
int dsac::tree::height_bad ( const Tree &  t)
Here is the call graph for this function:

◆ inorder()

template<typename Position , typename Container >
void dsac::tree::inorder ( Position  p,
Container &  visited 
)
Here is the call graph for this function:

◆ layout()

template<typename Position >
int dsac::tree::layout ( Position  p,
int  d,
int  x 
)

Returns total disk space of elements stored in subtree rooted at p d represents the known depth of p and x represents the next x-coordinate to be assigned returns the greatest x-coordinate that was assigned

Here is the call graph for this function:

◆ parenthesize()

template<typename Position >
void dsac::tree::parenthesize ( Position  p)

Prints parenthesized representation of subtree rooted at p.

Here is the call graph for this function:

◆ postorder()

template<typename Position , typename Container >
void dsac::tree::postorder ( Position  p,
Container &  visited 
)
Here is the call graph for this function:

◆ preorder()

template<typename Position , typename Container >
void dsac::tree::preorder ( Position  p,
Container &  visited 
)
Here is the call graph for this function:

◆ print_preorder_indent()

template<typename Position >
void dsac::tree::print_preorder_indent ( Position  p,
int  d = 0 
)

Prints preorder representation of subtree rooted at p having depth d.

Here is the call graph for this function:

◆ print_preorder_labeled()

template<typename Position >
void dsac::tree::print_preorder_labeled ( Position  p,
std::vector< int > &  path 
)

Prints labeled representation of subtree rooted at p having depth d.

Here is the call graph for this function: