Binary Search without Sorting
Computer Science Level 5Consider the following binary search code in Python :
1 2 3 4 5 6 7 8 9 10 11 12 13 

It works perfectly, unless if you forgot to sort \(L\) in the first place! Given that \(L\) is a permutation of 0 to 6 and \(x\) is an integer in \(L\), how many distinct inputs \((L,x)\) are there such that the code still works?
Your answer seems reasonable.
Find out if you're right!
Sign up to access problem solutions.
That seems reasonable.
Find out if you're right!
Already have an account? Log in here.