- Given The Following Struct That Represents A Binary Tree Struct Node Int Key Node Parent Node Left Node Righ 1 (39.17 KiB) Viewed 40 times
Given the following struct that represents a binary tree: struct Node ( }; int key; Node *parent; Node *left; Node *righ
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Given the following struct that represents a binary tree: struct Node ( }; int key; Node *parent; Node *left; Node *righ
Given the following struct that represents a binary tree: struct Node ( }; int key; Node *parent; Node *left; Node *right; Node (int k) key (k), parent (nullptr), left (nullptr), right (nullptr) {}; Write a recursive function that inserts a node in a binary search tree stored using the above structure. If the node passed in is a null pointer, then create the root node. Otherwise, add the node to the binary search tree. You can assume no equal keys will be added to the binary search tree and return the node that was originally passed to the function. 910 TOM MAD Use the below function signature (NOTE: this is not a class method) Node *addToBST (Node *node, int k)