Master 30 Software Developer interview questions covering algorithms, system design, and coding challenges.
Question 7 of 30
How to Answer 1
How to Answer 2
Example Answer
Community Answers

Tom Dushaj is a business and technology executive and the author of 'Resumes That Work.' Tom has vast experience providing solutions to Fortune 500 companies in the areas of Information Technology Consulting, ERP Software, Personnel Management, and Intern
The way I approach a binary search is to locate the position of an item in a sorted array. Going a bit deeper, I compare input values that sit in the middle element of the array. I can make a good comparison to determine whether an element equals the input, is less than input or is greater than an input. When an element is being compared, the search stops and typically returns the position of the element. That's the way I see it working. If an element is not equal to the input by chance, then a comparison is made to determine whether the input is less than or greater than the actual element. It can be argued, and I have seen it done where an algorithm starts repeatedly, but only searching the top or a bottom subset of an array's elements.

Tom Dushaj is a business and technology executive and the author of 'Resumes That Work.' Tom has vast experience providing solutions to Fortune 500 companies in the areas of Information Technology Consulting, ERP Software, Personnel Management, and Intern
This is the type of question an interviewer will ask if he starts to doubt your ability to perform certain duties revolving around algorithm-based development. Since software development at some level relies on algorithms and data structures, this will be an important question that you must understand and answer properly. If we look at how the binary search structure is broken down, it contains a binary search or half-interval search, a divide and conquers algorithm that seeks a position of an item in a sorted array. When a hiring manager asks about comparing inputs and output to the middle element of an array, they ask if a search returns the position of an element. It's important to know and understand this concept. Another question that may be asked is whether or not an input is less than or greater than an element. If you have a sound understanding of these concepts, ask the interviewer what level of detail you would like to answer their question. Some interviewers only want to hear a high-level answer, and others want a detailed explanation.

Tom Dushaj is a business and technology executive and the author of 'Resumes That Work.' Tom has vast experience providing solutions to Fortune 500 companies in the areas of Information Technology Consulting, ERP Software, Personnel Management, and Intern
"I have extensive experience and hands-on knowledge implementing binary search algorithms with and without recursion. For this answer, I will talk about BSA without recursion. Binary search algorithms typically halve the number of items checked for each successive iteration, thus locating the given item in logarithmic time. Furthermore, a Binary Search Implementation in a Java algorithm is implemented recursively respectively. Also, I would like to share an interesting fact that binary search algorithm implementation is mostly done without recursion. It is also known as iterative binary search."

Interview Coach
Jaymie
A real coach, not AI. I read every answer myself and write back with personalized feedback.
Typically responds within 24 hours.
0 - Character Count
Unlock expert responses to technical and behavioral questions interviewers ask developers.
Get StartedJump to Question

Written by Tom Dushaj
30 Questions & Answers • Software Developer

By Tom

By Tom