Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 ) Complete this table rounding each decimal to the nearest integer. This should give you a senseof the comparative growth rates of the functions.

1)Complete this table rounding each decimal to the nearest integer. This should give you a senseof the comparative growth rates of the functions. Note that lg(n) means pythons log2(n). lg(nn)nn nn nnnnnn(nn) nn2 nn32nn nn!12345678910 For #2,3, and 4, solve each summation in two ways: write out all terms of the sum and perform the arithmetic; then use one of the formulas in the class notes to confirm your answer. 2)15 ii2 ii=13)102ii ii=04) Follow the same instructions for #2 and #3; round off this answer to three decimal places. 2ii8ii=1 For #5, solve this summation in two ways: write out all terms of the sum, but there will be no arithmetic to perform; then use one of the formulas in the class notes to express the sum as a polynomial function of n.5) nn1 ii ii=1Asymptotic analysis for #6 and #7: Determine the Big-Oh class of each algorithm. That is, formally compute the worst-case running time as we did on class using a table to produce a function that tracks the work required by all lines of code. Include all steps of the algebraic simplification, but you do not need to provide comments to justify each step. 6) Arithmetic mean =add them all up, and divide by how many. Let the size of the problem = n = the number of entries in the array. 1 # Input: an array A of real numbers 2 # Output: the arithmetic mean of the entries in the array 3 def arithmeticMean(A): 4 sum =05 count =06 for x in A: 7 sum += x 8 count +=19 average = sum/count 10 return average 7)Sum of entries in an upper triangular nxn array. Let the size of the problem = n = thedimension of the nxn matrix. 1234 # Input: an upper triangular square matrices A where all entries below the diagonal =0, # and an integer n giving the dimension of this nxn matrix # Output: a real number giving the sum of the entries def UpperTriangularMatrixSum (A, n): 5 sum =06 for i in range(0, n): 7 for j in range(i, n): 8 sum += A[i][j]9 return sum

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions