searches.sentinel_linear_search¶

This is pure Python implementation of sentinel linear search algorithm

For doctests run following command: python -m doctest -v sentinel_linear_search.py or python3 -m doctest -v sentinel_linear_search.py

For manual testing run: python sentinel_linear_search.py

Attributes¶

user_input

Functions¶

sentinel_linear_search(sequence, target)

Pure implementation of sentinel linear search algorithm in Python

Module Contents¶

searches.sentinel_linear_search.sentinel_linear_search(sequence, target)¶

Pure implementation of sentinel linear search algorithm in Python

Parameters:
  • sequence – some sequence with comparable items

  • target – item value to search

Returns:

index of found item or None if item is not found

Examples: >>> sentinel_linear_search([0, 5, 7, 10, 15], 0) 0

>>> sentinel_linear_search([0, 5, 7, 10, 15], 15)
4
>>> sentinel_linear_search([0, 5, 7, 10, 15], 5)
1
>>> sentinel_linear_search([0, 5, 7, 10, 15], 6)
searches.sentinel_linear_search.user_input¶

thealgorithms-python

Navigation

index.md

  • Contributing guidelines
  • Getting Started
  • Community Channels
  • List of Algorithms
  • MIT License
  • API Reference
    • maths
    • other
    • sorts
    • graphs
    • hashes
    • matrix
    • ciphers
    • geodesy
    • physics
    • quantum
    • strings
    • fractals
    • geometry
    • graphics
    • knapsack
    • searches
    • financial
    • blockchain
    • scheduling
    • conversions
    • electronics
    • fuzzy_logic
    • backtracking
    • audio_filters
    • file_transfer
    • project_euler
    • greedy_methods
    • linear_algebra
    • neural_network
    • boolean_algebra
    • computer_vision
    • data_structures
    • networking_flow
    • web_programming
    • bit_manipulation
    • data_compression
    • machine_learning
    • cellular_automata
    • genetic_algorithm
    • divide_and_conquer
    • linear_programming
    • dynamic_programming
    • digital_image_processing

Related Topics

  • Documentation overview
    • API Reference
      • searches
        • Previous: searches.quick_select
        • Next: searches.simple_binary_search
©2014, TheAlgorithms. | Powered by Sphinx 8.2.3 & Alabaster 1.0.0 | Page source