Driver Code
public static void Main ( String [ ] args ) { Node root = null ; int [ ] keys = { 20 , 8 , 22 , 4 , 12 , 10 , 14 } ; foreach ( int x in keys ) root = insert ( root , x ) ; int k = 4 ; Node res = kthSmallest ( root , k ) ; if ( res == null ) Console . WriteLine ( " There ▁ are ▁ less ▁ " + " than ▁ k ▁ nodes ▁ in ▁ the ▁ BST " ) ; else Console . WriteLine ( " K - th ▁ Smallest " + " ▁ Element ▁ is ▁ " + res . data ) ; } }