To find the maximum and minimum in a binary tree is as simple as right and left. A binary search tree is comprised of the the top pointer, also known as the parent and additional nodes known as child nodes. The child nodes are referred to as the left child and the right child. The left nodes contain only keys that are less than the top node. The right nodes only contain keys that are more than the top node. So, to find the minimum key, you only have to transverse the leftmost side of the tree. Look to the rightmost side and you will find the maximum. If the tree is not balanced you will struggle to find the maximum and the minimum keys. This is why self balancing trees like AVL’s or red – black are a lot more effective than basic BST.(1)
Binary Search Tree with key insert order of 1,2,3,4,5,6,7
1
/
2 3
/ /
4 5 6 7
The output of a BFS traversal in this binary search tree above is:
1
2,3
4,5,6,7
B. Please comment to Armstrong A on this comment he made in 137 words.
The maximum and minimum Binary Search Tree is a Binary Tree with two additional properties. These properties are Nodes to the left of the root are lesser than the root node and the nodes to the right of the root node are greater than the root node.
In finding the maximum, start moving from root node and keep moving to the right node. In Binary Search Tree, we can find maximum by traversing right pointers until we reach the rightmost node. the data of all the nodes in the right sub-tree of the root node should be greater than or equals to the data of the root.
The rightmost thus obtained is the maximum of the BST. In finding the minimum, start from node and keep moving left to reach the leftmost node. In Binary Search Tree, we can find maximum by traversing right pointers until we reach the rightmost node. the data of all the nodes in the right sub-tree of the root node should be greater than or equals to the data of the root.. This leftmost node is the minimum of BST.
The output of a BFS traversal in a normal binary search tree if the key insert order is “1,2,3,4,5,6,7”, there are total 7 nodes in the given Binary search tree and also these entries are sorted in ascending order so the bfs traversal will be same as the input value i.e “1,2,3,4,5,6,7”
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more
Recent Comments