Question: X 1 2 7 5 : Linear Search ( Strings ) Return Index Complete the following linear search method. Find the string search in the

X1275: Linear Search (Strings) Return Index
Complete the following linear search method. Find the string search in the array words. If the string is found, return the index for the position. If is is not found, return -1. It is unspecified if the array is ordered or not, so assume it is not.
Examples:
linearSearch({"Charlotte", "Raleigh", "Greensboro" }, "Charlotte")0
linearSearch({"Charlotte", "Raleigh", "Greensboro"}, "Durham")-1
linearSearch({"Charlotte", "Raleigh", "Greensboro"},"Greensboro")2
Your Answer:
 X1275: Linear Search (Strings) Return Index Complete the following linear search

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!