WRITE IN C++ Enter integers through the keyboard. While entering the numbers, create a binary search tree.
Fantastic news! We've Found the answer you've been seeking!
Question:
WRITE IN C++ Enter integers through the keyboard. While entering the numbers, create a binary search tree. For a NULL node enter -1. For the created binary tree write its preorder, inorder, postorder and level order traversals. Then, ask the user to insert a value of a node in the tree. Write a function to find the predecessor of the given node (its value and address).
If the node is not found, the function should return NULL. If the found node is the root, the function should return NULL, as well. If the first value that is entered is equal to -1, then don't print the tree, its traversals or the predecessor of the given node, but instead only print a message that the tree is empty.
Example output:
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date: