linear search


See On Github

Data

Contributor

Generic placeholder thumbnail

by jcla1

in go

Tags

linear, search

Source Code

package linearSearch

func LinearSearch(arr []int, key int) int {
    for i, v := range arr {
        if v == key {
            return i
        }
    }
    return -1
}