Question
*************PLEASE ANSWER MY Q WITH EXPLAIN ***************** Find its time complexity by applying Master's method. int F(n) { if(n <1) return 1; int x =
*************PLEASE ANSWER MY Q WITH EXPLAIN *****************
Find its time complexity by applying Master's method.
int F(n) { if(n<1) return 1;
int x = F(n/2);
int y = F(n/2);
int z = F(n/2);
int t = F(n/2);
return x+y+z+t
q2)
using the theory behind Binary Search algorithm on an array of size 1 million, approximately how many comparisons will take place in the following cases: (note that approximate answer is expected, not exact. That is, 1 difference in your answer is OK)
a. The key is at the first index position.
b. The key is at the middle of the array.
c. The key is at the last index position.
d. The key is not present in the array.
Q3)
Write the time complexity of the following two functions F1 and F2 by identifying the theory behind InsertionSort and MergeSort. Assume that the input array A of size 'n' is reversely sorted.
F1(A)
{ InsertionSort(A);
MergeSort(A); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started