1) Consider searching algorithms on the following array of data: [22 ,21 ,9, 4 ,
ID: 2968015 • Letter: 1
Question
1) Consider searching algorithms on the following array of data:
[22 ,21 ,9, 4 ,16, 2 ,10, 14 ,20 ,31 ,26 ,19 ,17, 28 ,8 ,13]
(b) State the runtime for each of the searches, in this example, and for general data sets of size n. (and how you reached this run time). Show HOW you got this runtime. Give the runtime as a function and then as Big O.
State the SPECIFIC runtime of THIS sequential search. In other words, what is the exact numerical (number form) run time to find #19 in the given data array using a sequential search? Note, this is NOT Big-O, this will be a numerical value.
Explanation / Answer
a) Sequential Search: O(n^2)
b) Binary Search: O(n logn)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.