Economics Homework Help

Economics Homework Help. Stratford University Data Structures and Algorithms Project

 

I’m working on a macro economics multi-part question and need an explanation and answer to help me learn.

  1. UMD Data Structures and Algorithms

Big-O practice. Find T(n) and O() of this 14 questions.

  1. for (i=n; i<=2n, i+=2)
    for (j = 0; j < n; j++)
    print(“Hi Mom”)
  2. for (i=1; I <= 1000; i++)
    for (j=1; j<=n; j++)
    for (k=1; k<=1000; k++)
    for (l=1; l<=n; l++)
    x+=1;
  3. for (i=n*n*n; i>1; i/=n)
    print(“I Love Algorithms”)
  4. for (i=1; i<=n; i+=10)
    print(“Hi dad”)
  5. for (i=1; i<=n; i*=10)
    print(“hmmm…”)
  6. i=n
    While(i>1)
    i/=4;
  7. for (i=1; i<=n; i+=i)
    print(“aardvarks are nocturnal”)
  8. for (i=0; i<n; i++)
    for (j=0; j<=n; j+=2)
    print(“aardvarks eat ants”)
  9. for (i=0; i < n*n + 5*n + 17; i+=4)
    print(“get an aardvark for a pet today!”)
  10. for (i=0; i < n; i++){ if (i % 2 == 0)for (j = 0; j < 5*n*n, j++) print(“uh oh!”) }else{ for (j = 0; j < n/2, j++) print(“oh my”)}}
  11. for (i=0; i < n+1; i++)
    if (i = n-1)
    for (j=0; j <n; j++)
    print(“why?”)
    else
    print(“why not?”)
  12. i = n*n*n;
    i*=i;
    while (i > 5)
    print(“really?”)
    i -= 3;
  13. Suppose a method returns either 0, -1, and 1 with equal likelihood. If 0 is returned then 130 loop iterations occur. If -1 or 1 is returned then 75 iterations occur. What is T(n) in the best case, worst case, and average case?
  14. How does the previous T(n) change if the likelihood of 0 is 20% and -1 and 1 occur at 30% and 50% respectively?

Economics Homework Help