Tags | |
UUID | e6ef7ca7-0943-11ee-b65f-bc764e203090 |
A Linear Search is a type of searching algorithm that iterates through each item in a list, comparing each item in the list to the desired item until the first instance of it is found.
INSTRUCTIONS: Enter the following
Search Index (S): When an integer is found, the algorithm will return the INDEX of the number in the list
[62, 51, 28, 36, 20, 21, 12, 1, 76, 72, 92, 86, 9, 84, 67, 48, 37, 15, 69, 65, 24, 89, 42, 38, 33, 52, 27, 40, 26, 6, 61, 45, 79, 29, 34, 3, 17, 64, 7, 49, 11, 95, 25, 41, 50, 56, 77, 53, 14, 93, 78, 18, 32, 35, 74, 30, 75, 10, 57, 100, 58, 47, 39, 13, 5, 83, 63, 54, 46, 90, 8, 85, 16, 22, 2, 80, 73, 87, 31, 96, 60, 43, 82, 99, 97, 4, 94, 59, 19, 55, 44, 70, 81, 71, 88, 68, 23, 98, 91, 66] |
In an array or list, we count the index starting at 0. So a list of 5 elements has indexes 0-4:
first_item | second_item | third_item | fourth_item | fifth_item | ... | |
Index | 0 | 1 | 2 | 3 | 4 | ... |
No comments |