Thursday, 2 August 2012

C function to find the maximum value in a binary search tree.

//many will have confusion in the below pointer declaration
//int *ptr and int* ptr both are same


int maxValue(struct node *root) 
{ 
struct node *current = root; 

while (current->right != NULL) 
{ 
current = current->right; 
}
return(current->data); 
} 

No comments:

Post a Comment