I am looking at various implementations of AVL trees in particular a function to traverse the tree. I have come across different methods to achieve this however there is this one that i do not understand.
template <class TYPE, class KTYPE>
void AvlTree<TYPE, KTYPE>
:: AVL_Traverse (void (*process)(TYPE dataProc))
{
// Statements
_traversal (process, tree);
return;
} // end AVL_Traverse
/* ===================== _traversal =====================
Traverse tree using inorder traversal. To process a
node, we use the function passed when traversal is called.
Pre tree has been created (may be null)
Post all nodes processed
*/
template <class TYPE, class KTYPE>
void AvlTree<TYPE, KTYPE>
:: _traversal (void(*process)(TYPE dataproc),
NODE<TYPE> *root)
{
// Statements
if (root)
{
_traversal (process, root->left);
process (root->data);
_traversal (process, root->right);
} // if
return;
} // _traversal
in particular, in the above code could someone help me understand what this means and what it is doing
AVL_Traverse (void (*process)(TYPE dataProc))
i do not understand what this part means
AVL_Traverse (void (*process)
what is the pointer process used for?