A program stores data in a binary tree that is designed using Object-Oriented Programming (OOP). The tree stores data in ascending numerical order, for example: The class Tree stores the tree. (i) Write program code to declare the class Tree and its constructor. Do not declare the other methods. Use your programming language appropriate constructor. If you are writing in Python, include attribute declarations using comments. (ii) Write program code for GetRootNode () (iii) The method Insert() takes a node as a parameter and then searches the tree to find the position to insert the new node by: - checking whether the node's data is less than or greater than the root node's data - moving to the left node if the data is less than the root node's data - moving to the right node if the data is greater than or equal to the root node's data - repeating until the final position of the node is found and stores the node in that position. Write program code for Insert ()
Exam No:9618_s25_qp_41 Year:2025 Question No:3(c)
Answer:
 
  
  
  
  
 Knowledge points:
19.1 Algorithms
20.1 Programming Paradigms
Solution:
Download APP for more features
 1. Tons of answers.
 2. Smarter Al tools enhance your learning journey.
 IOS
Download
 Download
Android
Download
 Download
Google Play
Download
Download
