Comparator function which can compare the second element of structure used to sort pairs in increasing order of second value .
bool comparator ( struct val p1 , struct val p2 ) { return ( p1 . second < p2 . second ) ; }