Function to search the most recent location of element N If not present in the array it will return - 1
int search ( int a [ ] , int k , int x ) { int j ; for ( j = k - 1 ; j > -1 ; j -- ) { if ( a [ j ] == x ) return j ; } return -1 ; }