Given a binary search tree with root node having non-negative values, write a program to find the minimum absolute difference between values of any two nodes.

Problem Note

  • There are at least two nodes in the BST.

Example 1

Input: Given binary search tree
          7 
        /   \ 
       3     10 
      / \   / \ 
     2   5 8   12

Output: 1
Explanation: The minimum absolute difference is 1, which is the difference between 8 and 7 (or between 2 and 3).