Homework Solution: I need help with question 4, letters A, and B and question 8, letters A,B and C…

    Please do all the problems. Do not do half and submit it to me. Please do all of them. For all the questions please type the answers so I can see what you wrote. CTS-277 Data Structures and Algor i thms Review: Analysis of Algorithms 1. One way to determine the execution speed of an algorithm is to implement it in a programming language, execute the program, and directly measure the actual time it takes to complete. Briefly explain the possible problem(s) with this approach. 2 For each of the following code segments: -identify the statoments that are mice - identify the Big-o run-time (show how you arrived at the answer) sum sqr o for ( ct 0; ct 《 size: ++ ct ) , sum-sar += data [ct] * data [ct]; mean sqr sum_sqr size: b.1 sum=0; for( ct 1: ct sizei ++ct sum += ct; product = 1 ; for( ct = 1; ct 《= size; ++ct ) product ct: difference = product - sum; C. i max = datato, o); for( ctr = 0; ctr : n; ++ctr ) for( ctc = 0: ctc < n; ++etc ) if ( data [ctr] [ctc] 》 max ) max -data [ctr] [ctc] d max data [o, 0]: for ctr ctr 5 t+ctr if ( data [ctr] [ctc] 》 max ) max = data [ctr) [ctc) ; sum = 0; for( ctr o; ctr < 3; ++ctr ) sum += data [ctr] [ctc); f. /total f. /totalo for( ctr 0; ctr 《 n; ++ctr ) for( ctc # ctr + 1; ctc < n; ++ctc ) total data [ctr] [ctc); I need help with question number 2, Letters A,B,C,D,E, and F
    media%2Fc97%2Fc97e6402-17c1-4a02-8d6a-efThis is part of number 2. I need help with letters G,H,I,J,K, and L
    media%2Fba0%2Fba0c4fe9-2f3a-4539-a287-21 I need help with question 4, letters A, and B and question 8, letters A,B and C
    CTS-277 Data Structures and Algor i thms Review: Analysis of Algorithms 1. One way to determine the execution speed of an algorithm is to implement it in a programming language, execute the program, and directly measure the actual time it takes to complete. Briefly explain the possible problem(s) with this approach. 2 For each of the following code segments: -identify the statoments that are "mice" - identify the Big-o run-time (show how you arrived at the answer) sum sqr o for ( ct 0; ct 《 size: ++ ct ) , sum-sar += data [ct] * data [ct]; mean sqr sum_sqr size: b.1 sum=0; for( ct 1: ct sizei ++ct sum += ct; product = 1 ; for( ct = 1; ct 《= size; ++ct ) product ct: difference = product - sum; C. i max = datato, o); for( ctr = 0; ctr : n; ++ctr ) for( ctc = 0: ctc

    Expert Answer

     
    2. a) O(size) b) O(size)

    Gladden do whole the bearings. Do referable do half and propose it to me. Gladden do whole of them. Coercion whole the interrogations gladden emblem the rejoinders so I can distinguish what you wrote.
    CTS-277 Postulates Structures and Algor i thms Review: Analysis of Algorithms 1. One method to segregateicularize the attempt hasten of an algorithm is to appliance it in a programming speech, enact the program, and straighthabit estimate the explicit season it takes to full. Briefly decipher the feasible bearing(s) with this bearing. 2 Coercion each of the coercionthcoming sequence segments: -authenticate the statoments that are mice - authenticate the Big-o run-season (illusion how you arrived at the rejoinder) incorporate sqr o coercion ( ct 0; ct 《 largeness: ++ ct ) , incorporate-sar += postulates [ct] * postulates [ct]; average sqr incorporate_sqr largeness: b.1 incorporate=0; coercion( ct 1: ct largenessi ++ct incorporate += ct; issue = 1 ; coercion( ct = 1; ct 《= largeness; ++ct ) issue ct: contrariety = issue - incorporate; C. i max = postulatesto, o); coercion( ctr = 0; ctr : n; ++ctr ) coercion( ctc = 0: ctc < n; ++etc ) if ( postulates [ctr] [ctc] 》 max ) max -postulates [ctr] [ctc] d max postulates [o, 0]: coercion ctr ctr 5 t+ctr if ( postulates [ctr] [ctc] 》 max ) max = postulates [ctr) [ctc) ; incorporate = 0; coercion( ctr o; ctr < 3; ++ctr ) incorporate += postulates [ctr] [ctc); f. /whole f. /totalo coercion( ctr 0; ctr 《 n; ++ctr ) coercion( ctc # ctr + 1; ctc < n; ++ctc ) whole postulates [ctr] [ctc); I scarcity aid with interrogation mix 2, Learning A,B,C,D,E, and F
    media%2Fc97%2Fc97e6402-17c1-4a02-8d6a-efThis is segregate of mix 2. I scarcity aid with learning G,H,I,J,K, and L
    media%2Fba0%2Fba0c4fe9-2f3a-4539-a287-21 I scarcity aid with interrogation 4, learning A, and B and interrogation 8, learning A,B and C

    CTS-277 Postulates Structures and Algor i thms Review: Analysis of Algorithms 1. One method to segregateicularize the attempt hasten of an algorithm is to appliance it in a programming speech, enact the program, and straighthabit estimate the explicit season it takes to full. Briefly decipher the feasible bearing(s) with this bearing. 2 Coercion each of the coercionthcoming sequence segments: -authenticate the statoments that are “mice” – authenticate the Big-o run-season (illusion how you arrived at the rejoinder) incorporate sqr o coercion ( ct 0; ct 《 largeness: ++ ct ) , incorporate-sar += postulates [ct] * postulates [ct]; average sqr incorporate_sqr largeness: b.1 incorporate=0; coercion( ct 1: ct largenessi ++ct incorporate += ct; issue = 1 ; coercion( ct = 1; ct 《= largeness; ++ct ) issue ct: contrariety = issue – incorporate; C. i max = postulatesto, o); coercion( ctr = 0; ctr : n; ++ctr ) coercion( ctc = 0: ctc

    Expert Rejoinder

     

    2.
    a) O(size)
    b) O(size)
    c) O(n^2)
    d) O(1)
    e) O(n)
    f) O(n^2)
    g) O(size)
    h) O(size^2)
    i) O(size)
    j) O(n^2)
    k) O(n)
    l) O(n^2)
    4.
    a) O(n)
    0.004 seconds at n=200
    coercion n=4000; expected season = 0.004 * 20 = 0.08 seconds
    b) O(n^2)
    0.004 seconds at n=200
    coercion n = 4000; expected season = 0.004 *4000* 4000/ 40000 = 0.004*400 = 1.6 seconds

    8.
    a) O(n)
    b) O(n^2)
    c) O(n)