This function assumes that arr [ ] is sorted in increasing order according the first ( or smaller ) values in Pairs .
int maxChainLength ( Pair arr [ ] , int n ) { int i , j , max = 0 ; int * mcl = new int [ sizeof ( int ) * n ] ;