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, 22.06.2019 23:30
What are some ways to use a range name in a formula? check all that apply. in the defined names group, click use in formula, and then select the desired name. begin typing the name in the formula, select a name from the autocomplete list, and use the arrow keys and tab key to enter the name in the formula. begin typing the formula, and then click and drag with the mouse to select the cells to include in the formula. right-click one of the cells in the range. click formula options, and use the dialog box to add the name.
Answers: 1
question
Computers and Technology, 23.06.2019 03:00
Jason, samantha, ravi, sheila, and ankit are preparing for an upcoming marathon. each day of the week, they run a certain number of miles and write them into a notebook. at the end of the week, they would like to know the number of miles run each day, the total miles for the week, and average miles run each day. write a program to them analyze their data. your program must contain parallel arrays: an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. furthermore, your program must contain at least the following functions: a function to read and store the runnersโ€™ names and the numbers of miles run each day; a function to find the total miles run by each runner and the average number of miles run each day; and a function to output the results. (you may assume that the input data is stored in a file and each line of data is in the following form: runnername milesday1 milesday2 milesday3 milesday4 milesday5 milesday6 milesday7.)
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
:you areto design the controller for alight that functions both as an ordinary light and also as a motion activated light and alarm. a.if the manual switch s is on, then the light l is on. b.besides the manual switch, there is a motion detector, m1, which activatesthis light.c.if motion is detected but the light is on anyway because s is on, only then a secondoutput a, an alarm, is turned on. d.the disable switch, d, disables the motion activated light and alarmbut leaves manual control operation of the light using switch s.(i)read the problem statement and clearly identify the inputs and outputs for the circuit you are designing. (ii)create the truth table for this system; include the light, alarm, switch, disable, and the motion sensor.(iii)draw a schematic of this system.
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
File i/o activity objective: the objective of this activity is to practice working with text files in c#. for this activity, you may do all code in the main class. instructions: create an app that will read integers from an input file name numbers.txt that will consist of one integer per record. example: 4 8 25 101 determine which numbers are even and which are odd. write the even numbers to a file named even.txt and the odd numbers to a file named odd.txt.
Answers: 3
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
Mathematics, 23.06.2019 20:30
Questions on the website: 13722363