subject

1. (60 pts.) Analyzing Code. For each of the following, answer parts a-e. a.) (5pts.) Is the code correct? If not, provide a counterexample. b.) (3pts.) What is the asymptotic worst-case time complexity of the code. c.) (2pts.) What is the asymptotic worst-case space complexity of the code. d.) (3pts.) What is the asymptotic best-case time complexity of the code. e.) (2pts.) What is the asymptotic best-case space complexity of the code. i.) (15pts.) Maximum element (note this code is not the same as in the example in Notes3) double Max(double a[], int b, int e) { if (b>=e) { return a[b]; } else { int m=(b+e)/2; return(fmax(Max(a, b, m), Max(a, m+1, e))); } } // The following is the top level call to Max. // Returns the largest element in a. There are n elements in a[] double Max(double a[], int n) { return(Max(a, 0, n-1)); } ii.) (15pts.) Sequential Search version 1 int Find(double x, double a[], int b, int e) { if (b>=e) { if (a[e]==x) { return(e+1); } else { return(0); } } else { int m=(b+e)/2; int res=Find(x, a, b, m)

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 11:30
Which excel file extension stores automated steps for repetitive tasks?
Answers: 1
question
Computers and Technology, 24.06.2019 13:30
Consider jasper’s balance sheet. which shows how to calculate jasper’s net worth?
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
In a home that has 120 v service, there is an electric appliance that has a resistance of 12 ohms. how much power will this appliance consume? a. 10 w b. 120 w c 1200 w d. 1440 w
Answers: 1
question
Computers and Technology, 24.06.2019 21:00
How does a vaccine prevent sickness and individual?
Answers: 2
You know the right answer?
1. (60 pts.) Analyzing Code. For each of the following, answer parts a-e. a.) (5pts.) Is the code co...
Questions
question
Geography, 28.01.2020 12:31
question
Mathematics, 28.01.2020 12:31
Questions on the website: 13722362