logo

Crowdly

Browser

Add to Chrome

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

✅ 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

  BalancedBinarySearchTree bst

  for (k = 0; k < 964 * n; k += 5)

    twoWayLinkedList.addLast(k * 2)

    bst.put(k + 23 * k)

  for(i=0; i < 3*n; i++)        //

A C

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

      c++

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

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

D

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

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

    else

      for(j=0; j < 4*n*n; j++)        //

F I

        bst.find((i+j) * 4)        // 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