This post originally appeared on Arjun Rajkumar's blog. Arjun is a web developer based in Bangalore, India.
Write a method to find the 2nd largest element in a binary search tree.
A binary search tree is a binary tree in which, for each node, the node's value is greater than all values in the left subtree, and the node's value is less than all values in the right subtree.
If you want to follow along, feel free to post your answers in the comment.
My answers are in the comments.
This problem is from InterviewCake.