Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The above file contains implementation of sequential search and binary search. Y

ID: 3710589 • Letter: T

Question

The above file contains implementation of sequential search and binary search. You will use program to compare the performance of these two search techniques. Run the code few times and see what is going on. The program determines the execution times for binary search and sequential search for different list sizes. Evaluate the algorithm. After starting the program give the values as in the following interactions.( the list sizes number of iterations may need to be adjusted to ensure that the exections end in a reasonable amount of time.) Enter start list size: 100000 Enter end list size: 200000 Enter list size increment: 10000 Enter number of iterations for sequential search: 100 Enter number of iterations for binary search: 1000 Why would you run binary search many more times than sequential search?

Explanation / Answer

Solution:

The binary search should be run more times than sequential search because the binary search algorithm is efficient and takes less time to execute as compared to the sequential search.

The worst case time complexity of the binary search algorithm is computed to

T(n)= O(log n)

and

The worst case time complexity of the sequential search algorithm is computed to

T(n)= O(n)

That is the reason the binary search should be preferred.

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote