Let us create following BST 50 / \ / \ 30 70 / \ / \ / \ / \ 20 40 60 80
Node root = null ; root = insert ( root , 50 ) ; insert ( root , 30 ) ; insert ( root , 20 ) ; insert ( root , 40 ) ; insert ( root , 70 ) ; insert ( root , 60 ) ; insert ( root , 80 ) ; findPreSuc ( root , key ) ; if ( pre != null ) Console . WriteLine ( " Predecessor ▁ is ▁ " + pre . key ) ; else Console . Write ( " - 1" ) ; if ( suc != null ) Console . Write ( " Successor ▁ is ▁ " + suc . key ) ; else Console . Write ( " - 1" ) ; } }