Question
Write a procedure insert that can be used to add a node to a binary search tree. insert should take three parameters: the integer value
Write a procedure insert that can be used to add a node to a binary search tree. insert should take three parameters: the integer value to be added to the tree, the address of a memory word that contains the address of the root of the tree, and the address of a memory word containing the address of the first node in the free list. If there is already a node in the tree that contains that integer value, the tree should not be changed. Otherwise, a node should be unlinked from your free list (using alloc), the integer value to be added to the tree should be stored in that node, and the node linked into the tree in a position that maintains the binary search tree ordering.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started