Searching other element in struct in Binary Search Tree in i have already implemented whole code...the BST is sorted by ID.But what can i do to find the highest number of other element?struct TNode {int id;char name[100];float balance;TNode * left;TN

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/30 23:44:06

Searching other element in struct in Binary Search Tree in i have already implemented whole code...the BST is sorted by ID.But what can i do to find the highest number of other element?struct TNode {int id;char name[100];float balance;TNode * left;TN
Searching other element in struct in Binary Search Tree in
i have already implemented whole code...the BST is sorted by ID.But what can i do to find the highest number of other element?
struct TNode {
int id;
char name[100];
float balance;
TNode * left;
TNode * right;
};
bool addCustomer (TNode ** root,char * name,int id,float bal){
if (*root == NULL){
TNode * newNode = (TNode*)malloc(sizeof (TNode));
if (newNode == NULL)
return false;
newNode->id = id;
strcpy (newNode->name,name);
newNode->balance=bal;
newNode->left = NULL;
newNode->right = NULL;
*root = newNode;
}else if ((*root)->id < id){
addCustomer (&((*root)->right),name,id,bal);
}else if ((*root)->id > id){
addCustomer (&((*root)->left),name,id,bal);
}
return true;
}
//add customer function sort the BST with ID
TNode * findCustomer(TNode * root,int id){
if (root == NULL){
return NULL;
}else{
if (root->id < id){
return (findCustomer (root->right,id));
}else{
if (root->id > id){
return (findCustomer (root->left,id));
}else{
return root;
}
}
}
}
TNode * findRichestCustomer(TNode * root){
//i want to find the node that have highest amount...what should i put in here?
}
these are my codes.i am just beginner in C language...
i don't know what should i write inside the findRichestCustomer function with just one parameter passed.
need help...

Searching other element in struct in Binary Search Tree in i have already implemented whole code...the BST is sorted by ID.But what can i do to find the highest number of other element?struct TNode {int id;char name[100];float balance;TNode * left;TN
Yes. All fingerprints are different. The law enforcement agencies use fingerprints to identify the real criminals. The fingerprints are also used in checking the identities of visitors, tourists, and employees.