# Searching Implementations

Last updated: 2nd Dec, 2020

## Linear Search

Module:search_algorithms()
Method : linear_search(arr,key,hint=False)
Uses : To search the key value in the array andd return it's position once found, this method also shows the time taken to run the program.
Parameters : arr - an one dimensional array as python list, key is the key value to be searched in the array, hint is passed False by default, by declaring hint=True a detailed description of the linear search algorithm can be found.

###### Python Code Example

    from edualgo import algorithms as al
    ping = al.search_algorithms()
    arr = [10,9,4,5,7,8]
    ping.linear_search(arr,5)

    Output:
    Linear Search Runtime = 0.0

    3

For getting the hint just pass hint=True in the function like - linear_search(arr,key,True).

## Binary Search

Module:search_algorithms()
Method : binary_search(arr,key)
Uses : To search the key value in the array andd return it's position once found
Parameters : arr - an one dimensional array as python list, key is the key value to be searched in the array.

###### Python Code Example

    from edualgo import algorithms as al
    ping = al.search_algorithms()
    arr = [10,9,4,5,7,8]
    ping.binary_search(arr,5)

    Output:
    3

### Are you an ambitious Python Developer ?

Do you want to contribute to our project ? We welcome every python lover to come forwards and have some fun with our source code. Steps to contibute:

- Send an email to the developer here regarding your willingness to contribute to the project.
- Have a read of our "How To Contribute" documentation here.

Keep coding, keep loving python