Answers for "where to implement linear search algorithm"

C++
0

linear search implementation

def linear_search(lst, target):
    """Returns the index position of the target if found, else returns -1"""

    for i in range(0, len(lst)):
        if lst[i] == target:
            return i
    return -1
Posted by: Guest on December-06-2021

Code answers related to "where to implement linear search algorithm"

Browse Popular Code Answers by Language