Rotate image (square matrix) by 90 deg
Tue, 06 May 2025
Earlier, we have seen how to find the minimum element in a Binary Search Tree. Write a function which will return the maximum value in a binary search tree. For example:
For the below Binary search tree, the function should return 40

Structure of the Node of the Tree is as given below:
struct Node
{
int data;
Node* lptr; // Ptr to LEFT subtree
Node* rptr; // ptr to RIGHT subtree
};
Solution:
Function to get the maximum element in the tree will also be similar:
int getMaximum(Node* root)
{
while(root->rptr != NULL)
root = root->rptr;
return root->data;
}
Tue, 06 May 2025
Tue, 06 May 2025
Tue, 06 May 2025
Leave a comment