logo

Crowdly

Browser

Add to Chrome

int find_c(int n)   int i,j,c   TwoWayLinkedList twoWayLinkedList   Arr...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

int find_c(int n)

  int i,j,c

  TwoWayLinkedList twoWayLinkedList

  ArrayList arrayList

  for (k = 0; k < 834 * n; k += 19)

    twoWayLinkedList.addLast(k * 2)

    arrayList.addLast((k*k) mod n)

  for(i=1; i < n; i=i*3)        //

A C

    for(j=400; j > 1; j--)        // B

      c++

  for(i=c; i > 0; i--)

    if(random(0...99) > 0)        //

D

      for(j=0; j < 3*n; j++)        // E J

        twoWayLinkedList.find(i+j+c)        // G

    else

      for(j=2*n*n; j > 0; j--)        //

F I

        arrayList.find(i/5 + c*j)        // H

  return c

Mis on antud algoritmi halvima juhu kogukeerukus O-notatsioonis sõltuvalt sisendparameetrist n: (Liigne vastus on see, mis jääb üle)

NB! Ka liigse vastuse lahter tuleb täita punktide saamiseks!

A -> tsükli korduste arv

B -> tsükli keerukus kokku

C -> tsükli keerukus kokku

D -> if-else keerukus kokku

E -> tsükli korduste arv

F -> tsükli korduste arv

G -> operatsiooni keerukus

H -> operatsiooni keerukus

I -> tsükli keerukus kokku

J -> tsükli keerukus kokku

More questions like this

Want instant access to all verified answers on moodle.taltech.ee?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome