Question: Exercise There are 5 integers stored in an array named arr . The diagram below shows the elements of the array. 45 78 12 99
Exercise
There are 5 integers stored in an array named arr. The diagram below shows the elements of the array.
| 45 | 78 | 12 | 99 | 50 |
| 0 | 1 | 2 | 3 | 4 |
45 is stored at index 0, 78 at index 1 and so forth. Assumming that the process of accessing a particular element will take 1 second.
How much time is needed to search for
- 45
- 12
- 50
- 100
Lets say the array contains 1 million integers. How much time it will take for searching -1. Hint: n is the size of the array.
What is the algorithm that works such as the example above?
Give another searching algorithm that works with the different way.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
