Question: Implement a Set using a binary search tree and following the interface shown below. template struct Node { T value; Node * left;
Implement a Set using a binary search tree and following the interface shown below.\ \ template \ struct Node {\ T value;\ Node * left;\ Node * right;\ };\ \ template \ struct Set {\ Node * root;\ };\ \ template void initialize(Set>T< &set);\ template void destroy(Set>T< &set)\ template void insert(Set>T< &set,T item);\ template void remove(Set>T< &set,T item);\ template bool contains(Set>T< &set,T item);\ template int size(Set>T< &set);\ The pointer root should reference a binary search tree of Nodes holding the members currently in the Set.\ \ initialize() sets up the data structure\ destroy() cleans up the before Set goes out of scope\ insert() includes item as member of the Set\ remove() excludes item from being a member of the Set\ contains() reports whether item is currently a member of the Set\ size() reports the current size (cardinality) of the Set
Step by Step Solution
There are 3 Steps involved in it
To solve this problem youll need to implement a Set data structure using a binary search tree BST The functions and their purposes are already defined ... View full answer
Get step-by-step solutions from verified subject matter experts
