Driver code
int main ( ) { int arr [ ] = { 5 , 1 , 4 , 4 , 5 , 9 , 7 , 13 , 3 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int x = 4 ; Node * root = NULL ; for ( int i = 0 ; i < n ; i ++ ) root = insert ( root , arr [ i ] ) ; cout << " Rank ▁ of ▁ " << x << " ▁ in ▁ stream ▁ is : ▁ " << getRank ( root , x ) << endl ; x = 13 ; cout << " Rank ▁ of ▁ " << x << " ▁ in ▁ stream ▁ is : ▁ " << getRank ( root , x ) << endl ; x = 8 ; cout << " Rank ▁ of ▁ " << x << " ▁ in ▁ stream ▁ is : ▁ " << getRank ( root , x ) << endl ; return 0 ; }