Implement a function to perform a binary search on a sorted array.
Instruction: Write a function that performs a binary search on a sorted array and returns the index of the element if found, otherwise -1.
Context: This question assesses the candidate's algorithm skills and their ability to implement efficient search algorithms.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
To clarify the question, you're asking me to write a function that efficiently searches...