TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
defines the functions associated with the binary tree More...
Public Member Functions | |
Node * | createNewNode (int64_t) |
function that will create new node for insertion. | |
std::vector< int64_t > | preOrderIterative (Node *) |
preOrderIterative() function that will perform the preorder traversal iteratively, and return the result array that contain the preorder traversal of a tree. | |
std::vector< int64_t > | postOrderIterative (Node *) |
postOrderIterative() function that will perform the postorder traversal iteratively, and return the result array that contain the postorder traversal of a tree. | |
std::vector< int64_t > | inOrderIterative (Node *) |
inOrderIterative() function that will perform the inorder traversal iteratively, and return the result array that contain the inorder traversal of a tree. | |
defines the functions associated with the binary tree
Definition at line 67 of file iterative_tree_traversals.cpp.
Node * others::iterative_tree_traversals::BinaryTree::createNewNode | ( | int64_t | data | ) |
function that will create new node for insertion.
will allocate the memory for a node and, along the data and return the node.
data | value that a particular node will contain. |
Definition at line 88 of file iterative_tree_traversals.cpp.
std::vector< int64_t > others::iterative_tree_traversals::BinaryTree::inOrderIterative | ( | Node * | root | ) |
inOrderIterative() function that will perform the inorder traversal iteratively, and return the result array that contain the inorder traversal of a tree.
function that takes root of the tree as an argument, and returns its inorder traversal.
root | head/root node of a tree |
< is used to find and traverse the child nodes.
< List of values, sorted in in-order.
Definition at line 164 of file iterative_tree_traversals.cpp.
std::vector< int64_t > others::iterative_tree_traversals::BinaryTree::postOrderIterative | ( | Node * | root | ) |
postOrderIterative() function that will perform the postorder traversal iteratively, and return the result array that contain the postorder traversal of a tree.
function that takes root of the tree as an argument, and returns its postorder traversal.
root | head/root node of a tree |
< is used to find and traverse the child nodes.
< List of values, sorted in post-order.
Definition at line 132 of file iterative_tree_traversals.cpp.
std::vector< int64_t > others::iterative_tree_traversals::BinaryTree::preOrderIterative | ( | Node * | root | ) |
preOrderIterative() function that will perform the preorder traversal iteratively, and return the result array that contain the preorder traversal of a tree.
function that takes root of the tree as an argument, and returns its preorder traversal.
root | head/root node of a tree |
< is used to find and traverse the child nodes.
< list of values, sorted in pre-order.
Definition at line 102 of file iterative_tree_traversals.cpp.