Hi, I am having trouble with trying to calculate asymptotic time complexity for each of these functions. A step by step tutorial would be great. This is done in Python. Please not only the answer, but how you calculated it as well.
Here is the code
| #Q2 | |
| # to denote ayymptotic time complexity use the following notation | |
| # O(l) O(m) O(a) O(b) | |
| # e.g. traversing through l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] is O(l) | |
| #1 | |
| def merge(): | |
| l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
| m = [15, 16, 17, 18] | |
| lm = [] | |
| for l_i in l: | |
| lm.append(l_i) | |
| for m_i in m: | |
| lm.append(m_i) | |
| print("lm:{}".format(lm)) | |
| #2 | |
| def merge_a_lot(): | |
| l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
| m = [15, 16, 17, 18] | |
| lm = [] | |
| for l_i in l: | |
| lm.append(l_i) | |
| for m_i in m: | |
| lm.append(m_i) | |
| print("lm:{}".format(lm)) | |
| #3 | |
| def go_through(): | |
| l = 10 | |
| lm = [] | |
| while l>0: | |
| lm.append(l) | |
| l=int(l/2) | |
| print("lm:{}".format(lm)) | |
| #4 | |
| def go_through_two(): | |
| l = 10 | |
| m = 5 | |
| lm = [] | |
| while l > 0: | |
| lm.append(l) | |
| l = int(l/2) | |
| m1=1 | |
| while m1*m1 <= m: | |
| print("in") | |
| lm.append(m1) | |
| m1 +=1 | |
| print("lm:{}".format(lm)) | |
| #5 | |
| def go_through_cross_two(): | |
| l = 10 | |
| m = 5 | |
| lm = [] | |
| while l*l > 1: | |
| lm.append(l) | |
| l -= 1 | |
| m1 = 1 | |
| while m1*m1 <= m: | |
| lm.append(m1) | |
| m1 += 1 | |
| print("lm:{}".format(lm)) | |
| #6 | |
| def times(): | |
| a=100 | |
| b=5 | |
| sum=b | |
| count=0 | |
| while sum<=a: | |
| sum+=b | |
| count+=1 | |
| print("count:{}".format(count)) |
In: Computer Science
South Shore Construction builds permanent docks and seawalls along the southern shore of long island, new york. Although the firm has been in business for only five years, revenue has increased from $320,000 in the first year of operation to $1,116,000 in the most recent year. The following data show the quarterly sales revenue in thousands of dollars:
| Quarter | Year 1 | Year 2 | Year 3 | Year 4 | Year 5 |
| 1 | 23 | 59 | 76 | 92 | 184 |
| 2 | 103 | 158 | 156 | 202 | 290 |
| 3 | 178 | 267 | 327 | 384 | 453 |
| 4 | 16 | 48 | 49 | 82 |
189 |
a. Use Excel Solver to find the coefficients of a multiple
regression model with dummy variables as follows to develop an
equation to account for seasonal effects in the data. Qtr1 = 1 if
Quarter 1, 0 otherwise; Qtr2 = 1 if Quarter 2, 0 otherwise; Qtr3 =
1 if Quarter 3, 0 otherwise. Round your answers to two decimal
places.
Ft = _ + _Qtr1 + _Qtr2 + _Qtr3
b. Let Period = 1 to refer to the observation in Quarter 1 of
year 1; Period = 2 to refer to the observation in Quarter 2 of year
1; . . . and Period = 20 to refer to the observation in Quarter 4
of year 5. Using the dummy variables defined in part (b) and
Period, develop an equation to account for seasonal effects and any
linear trend in the time series using Excel Solver. Round your
answers to two decimal places. If your answer is negative value
enter minus sign.
Ft = _ + _Qtr1 + _Qtr2 + _Qtr3 + _Period
Based upon the seasonal effects in the data and linear trend,
compute estimates of quarterly sales for year 6. Round your answers
to one decimal place.
Quarter 1 forecast =
Quarter 2 forecast =
Quarter 3 forecast =
Quarter 4 forecast =
In: Math
Problem 15-28 (Algorithmic)
South Shore Construction builds permanent docks and seawalls along the southern shore of long island, new york. Although the firm has been in business for only five years, revenue has increased from $320,000 in the first year of operation to $1,188,000 in the most recent year. The following data show the quarterly sales revenue in thousands of dollars:
| Quarter | Year 1 | Year 2 | Year 3 | Year 4 | Year 5 |
| 1 | 23 | 38 | 83 | 97 | 202 |
| 2 | 103 | 137 | 163 | 207 | 308 |
| 3 | 178 | 246 | 334 | 389 | 471 |
| 4 | 16 | 27 | 56 | 87 | 207 |
In: Operations Management
Suppose it is known that the graph of the function y = ax3 + bx2 + cx + d passes through four given points (xi, yi ), i = 1, 2, 3, 4. Write a userdefined function that accepts these four points as input and computes the coefficients a, b, c, and d. The function should solve four linear equations in terms of the four unknowns a, b, c, and d. Test your function for the case where (xi , yi) = (-2, -20), (0, 4), (2, 68), and (4, 508), whose answer is a = 7, b = 5, c = -6, and d = 4.
In: Mechanical Engineering
Please help to answer question for 5 drugs
1. Classification:
2. General Indications
3. Adverse Side Effects:
4. Contraindications:
5. Labs to Review:
6. Special Considerations (Before administration, After administration, Nursing Considerations)
Drug name
1.acetaminophen (TYLENOL)
2. LORazepain (ATIVAN)
3. Heparin 5,000 units/mL injection
4. HydroCHLOROthiazide
5. Tamsulosin (FLOMAX )
Please answer base on David guide drug book
In: Nursing
In each case, compute the derivative dy dx . Do not simplify your answer.
a) y= 4x^3e^5x
b) y=ln {(x^3 + 3x)(2x^4 -1)} using product rule
c) f (x) = x^4 ln 3x - 2/ e^2x
d) y= ln(2x^3)/ (4x^2-1)
Please show all work and label answers according to question number / letter
In: Math
1. Of the physical changes listed below, which one absorbs energy?
|
sublimation |
|||||||||||||||||||||||||||
|
condensing |
|||||||||||||||||||||||||||
|
freezing |
|||||||||||||||||||||||||||
|
deposition 2. As a solid melts to form a liquid, its temperature increases. True False 3. Which term below best describes the element americium, Am?
|
In: Chemistry
This exercise must be completed on the four subscales below, and you should, therefore, produce four reliability analyses.
In: Statistics and Probability
Five coins were simultaneously tossed 1000 times and at each toss, the number of heads was observed. The number of tosses during which 0, 1, 2, 4, and 5 heads were obtained are shown in the table below. Convert the given frequency distribution to probability distribution find the expected value.
Number of heads per toss: 0 1 2 3 4 5
Number of tosses : 38 144 342 287 164 25
In: Statistics and Probability
In: Accounting