CSCE 221-(507-509)
Programing Assignment 2
Overview MySTL Testing Todos
 All Classes Namespaces Files Functions Variables Typedefs Friends Groups Pages
List of all members
mystl::map< Key, Value >::node Struct Reference

Internal structure for binary search tree. More...

Public Member Functions

Constructors
 node (const value_type &v=value_type())
 Constructor. More...
 
 node (const node &n)
 Copy constructor. More...
 
nodeoperator= (const node &n)=delete
 Copy assignment - Deleted. More...
 
 ~node ()
 Destructor. More...
 
Modifiers
nodereplace (const value_type &v)
 Replace node with a new node of a different value. More...
 
void expand ()
 Expand external node to make it internal. More...
 
noderemove_above_external ()
 Remove above external node, assumes this is external node. More...
 
Accessors
bool is_root () const
 
bool is_external () const
 
bool is_internal () const
 
nodeleftmost () const
 
nodeinorder_next ()
 
nodeinorder_prev ()
 

Public Attributes

Data
value_type value
 Value is pair(key, value) More...
 
nodeparent
 Parent node. More...
 
nodeleft
 Left node. More...
 
noderight
 Right node. More...
 

Detailed Description

template<typename Key, typename Value>
struct mystl::map< Key, Value >::node

Internal structure for binary search tree.

Constructor & Destructor Documentation

template<typename Key , typename Value >
mystl::map< Key, Value >::node::node ( const value_type v = value_type())

Constructor.

Parameters
vMap entry (Key, Value) pair
template<typename Key , typename Value >
mystl::map< Key, Value >::node::node ( const node n)

Copy constructor.

Parameters
nnode to perform deep copy from
Todo:
Finish implementation of this copy constructor. Hint: left and right are not copied correctly at the moment
template<typename Key , typename Value >
mystl::map< Key, Value >::node::~node ( )

Destructor.

Todo:
Implement node destructor

Member Function Documentation

template<typename Key , typename Value >
node& mystl::map< Key, Value >::node::operator= ( const node n)
delete

Copy assignment - Deleted.

Parameters
nOther node
template<typename Key , typename Value >
node* mystl::map< Key, Value >::node::replace ( const value_type v)

Replace node with a new node of a different value.

Parameters
vNew value
Returns
Pointer to new node
template<typename Key , typename Value >
void mystl::map< Key, Value >::node::expand ( )

Expand external node to make it internal.

template<typename Key , typename Value >
node* mystl::map< Key, Value >::node::remove_above_external ( )

Remove above external node, assumes this is external node.

Returns
Sibling of n, who is promoted to n's parent's position
template<typename Key , typename Value >
bool mystl::map< Key, Value >::node::is_root ( ) const
Returns
If parent is null return true, else false
template<typename Key , typename Value >
bool mystl::map< Key, Value >::node::is_external ( ) const
Returns
If both children are null return true, else false
template<typename Key , typename Value >
bool mystl::map< Key, Value >::node::is_internal ( ) const
Returns
If it is not external then it is internal
template<typename Key , typename Value >
node* mystl::map< Key, Value >::node::leftmost ( ) const
Returns
Leftmost child of this node
template<typename Key , typename Value >
node* mystl::map< Key, Value >::node::inorder_next ( )
Returns
Next node in the binary tree according to an inorder traversal
template<typename Key , typename Value >
node* mystl::map< Key, Value >::node::inorder_prev ( )
Returns
Previous node in the binary tree according to an inorder traversal

Member Data Documentation

template<typename Key , typename Value >
value_type mystl::map< Key, Value >::node::value

Value is pair(key, value)

template<typename Key , typename Value >
node* mystl::map< Key, Value >::node::parent

Parent node.

template<typename Key , typename Value >
node* mystl::map< Key, Value >::node::left

Left node.

template<typename Key , typename Value >
node* mystl::map< Key, Value >::node::right

Right node.


The documentation for this struct was generated from the following file: