Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Linear search
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===In an ordered table=== If the list is ordered such that {{math|''L''<sub>0</sub> ≤ ''L''<sub>1</sub> ... ≤ ''L''<sub>''n''β1</sub>}}, the search can establish the absence of the target more quickly by concluding the search once {{math|''L''<sub>''i''</sub>}} exceeds the target. This variation requires a sentinel that is greater than the target.{{Sfn|Knuth|1998|loc=Β§6.1 ("Sequential search"), subsection "Algorithm T"}} # Set {{math|''i''}} to 0. # If {{math|''L''<sub>''i''</sub> ≥ ''T''}}, go to step 4. # Increase {{math|''i''}} by 1 and go to step 2. # If {{math|''L''<sub>''i''</sub> {{=}} ''T''}}, the search terminates successfully; return {{math|''i''}}. Else, the search terminates unsuccessfully.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)