Computers and Technology, 21.09.2020 05:01 tylerineedhelp
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)
Answers: 2
Computers and Technology, 22.06.2019 19:20, SundaeSunday
Consider the following code snippet: #ifndef cashregister_h#define cashregister_hconst double max_balance = 6000000.0; class cashregister{public: cashregister(); cashregister(double new_balance); void set_balance(double new_balance); double get_balance() const; private: double balance[12]; }; double get_monthly_balance(cashregister bk, int month); #endifwhich of the following is correct? a)the header file is correct as given. b)the definition of max_balance should be removed since header files should not contain constants. c)the definition of cashregister should be removed since header files should not contain class definitions. d)the body of the get_monthly_balance function should be added to the header file.
Answers: 1
Computers and Technology, 23.06.2019 15:00, abelxoconda
1. which of the following statements are true about routers and routing on the internet. choose two answers. a. protocols ensure that a single path between two computers is established before sending packets over it. b. routers are hierarchical and the "root" router is responsible for communicating to sub-routers the best paths for them to route internet traffic. c. a packet traveling between two computers on the internet may be rerouted many times along the way or even lost or "dropped". d. routers act independently and route packets as they see fit.
Answers: 2
Computers and Technology, 24.06.2019 05:00, alfarodougoy8lvt
Who is most likely be your target audience if you create a slide presentation that had yellow background and purple text
Answers: 2
1. (60 pts.) Analyzing Code. For each of the following, answer parts a-e. a.) (5pts.) Is the code co...
Physics, 28.07.2021 04:50
Social Studies, 28.07.2021 04:50
Mathematics, 28.07.2021 04:50