Task4: Minimum Distance Between BST Nodes (25 pts) . Given a Binary Search Tree (BST), write a program to return the min
Posted: Fri May 20, 2022 5:49 pm
Task4: Minimum Distance Between BST Nodes (25 pts) . Given a Binary Search Tree (BST), write a program to return the minimum distance or difference between the values of any two different nodes in the tree. • Implement int minDist(Node" root); • Note: . You can assume the BST is always valid and has more than two nodes. . You can assume no duplicate values in BST. . The value range of BST nodes is (0,100). . The results of minimum distance is [1,100]. • For example The minimum distance is 3, The minimum distance is (node 15 with node 12) 1. (node 2 with node 3) Data Structures and Algorithms 11 Task4: Minimum Distance Between BST Nodes (25 pts) • Submit the complete code set including • Struct definition • Declaration and implementation for every necessary method. . A main function which runs your own test cases . You may need to include the implementation for the following methods, in order to build the BST in main function • Node insertNode (Node **proot, int x); • Node* createNode(int x); The distance is The Rini distance is The minimum distance is Demo results