Pregunta de entrevista de UST

Q: Explain the Binary search algorithm.

Respuesta de la entrevista

Anónimo

30 sep 2024

Binary Search Algorithm As we know it, from the name itself represents ‘two’, and in this approach, we use divide and conquer method . In a array , we will divide the array to find a key element by finding the mid element and check whether the key element is higher or lesser than the mid value (i.e.,we take the part which is nearest to key element) by this way we divide and conquer into 2 parts as long as as we get the key element. This can be mathematically represented as: 1/2+1/4+1/8+1/16+…+infinity=O(log n)