Jabong.com interview question

Recursive function and some logics for sorting, data structure, mysql queries