Working implemention of searching in rotated sorted array and binary search