📜  线性搜索 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:47.290000             🧑  作者: Mango

代码示例3
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