Improved check_params and added sort selection logic in binary search
Test with copy of original array