Write a C program to find the mininum value in a binary search tree.

Here is some sample C code. The idea is to keep on moving till you hit the left most node in the tree

  1. int minValue(struct node* node)
  2. {
  3. struct node* current = node;
  4.  
  5. while (current->left != NULL)
  6. {
  7. current = current->left;
  8. }
  9. return(current->data);
  10. }

On similar lines, to find the maximum value, keep on moving till you hit the right most node of the tree.