Consider the following structures and resulting tree
that permits duplicate keys. Duplicates are stored as a linked-list
that is linked to the tree node. Implement a function that finds
all occurrences of a given data key and returns the count. Assume
the tree can be accessed with a global pointer named root. For
example, for the following tree, find(‘A’) would return
3.
struct datanode {
int data;
datanode * next;
};
struct treenode {
datanode * next;
treenode * left;
treenode * right;
};
// returns the count of key
int find(int key);
ААА B СС)
Consider the following structures and resulting tree that permits duplicate keys. Duplicates are stored as a linked-list
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am