CS 106X Midterm: CS 106 X Midterm Exam Fall 2018

53 views12 pages

Document Summary

Problem 1: code reading (20 points) (note: you may need to scroll right to view the entire question description). For both of the calls to the following recursive function below, indicate the state of the. } else if (v[i] > v[j]) { v[j] += v[i]; return v[i] + mystery(v, s, i + 1, j); } else { v[i] += v[j]; return v[j] + mystery(v, s, i, j + 1): call: Set s; int returnvalue = mystery(v, s, 0, 2): call: Set s; int returnvalue = mystery(v, s, 0, 1); Problem 2: code reading (20 points) (note: you may need to scroll right to view the entire question description). Give a tight bound of the nearest runtime complexity class for each of the following code fragments in big-oh notation, in terms of variable n. (in other words, the algorithm"s runtime growth rate as n grows. )

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents