Intern — Middle
Searching for an element in a sorted array using a binary algorithm
livecode
Task condition
Given an array of integers sorted in ascending order. Write a binary search function that returns the position of the sought value, and if the value is absent — returns -1.
package main
import "fmt"
func main() {
data := []int{1, 2, 5, 10, 100}
// implement binary search here
fmt.Println(data)
}