logo

Crowdly

Browser

Add to Chrome

Algoritmid ja andmestruktuurid (LTAT.03.005)

Looking for Algoritmid ja andmestruktuurid (LTAT.03.005) test answers and solutions? Browse our comprehensive collection of verified answers for Algoritmid ja andmestruktuurid (LTAT.03.005) at moodle.ut.ee.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Mis ülesannet lahendab järgnev funktsioon?

def f(n):

if n < 0:

return False

if n == 0:

return True

return f(n-1)

0%
0%
0%
0%
0%
0%
View this question

// <![CDATA[

var sone, ulObj;

sone = rekursioon_soned[Math.floor(Math.random()*rekursioon_soned.length)];

ulObj = new Object();

ulObj.arg = "\"" + sone + "\"";

ulObj.funktsioon = tag3();

document.write(mis_ekraanil(ulObj));

// ]]>

Mille prindib järgmine funktsioon sisendil "ALGORITM"?

def tag(sõne):

if len(sõne) == 0:

return

print(sõne[0], end=' ')

tag(sõne[1:])

print(sõne[0], end=' ')

0%
0%
0%
0%
0%
0%
0%
0%
View this question

Olgu antud järgmised funktsioonid naturaalarvude paarsuse arvutamiseks:

def paaris(n):

if n == 0:

return True

return paaritu(n-1)

def paaritu(n):

if n == 1:

return False

return paaris(n-1)

Milline järgnevatest väidetest on tõene?

0%
0%
0%
0%
View this question

Olgu antud järgnev rekursiivne funktsioon, mis peaks leidma arvu kahega jagamisel tekkiva jäägi. Kas see funktsioon peatub iga täisarvulise sisendi korral?

def mod2(n):

if n == 0:

return 0

if n == 1:

return 1

return mod2(n-2)

0%
0%
0%
0%
0%
0%
View this question
View this question

Vaatleme rekursiivset funktsiooni

public static void f(int n) {

if (n > 1) {

System.out.println(n*n);

f(n-2);

}

}

Milline väide on tõene?

0%
0%
0%
0%
0%
View this question
View this question

Mis on rekursiooni sammu mõte?

0%
0%
100%
0%
View this question

Mille tagastab järgmine funktsioon, kus funktsiooni parameetriks on teatav täisarvude järjend a?

public static int f(int[] a) {

if (a.length == 1) {

return a[0];

} else {

int x = f(Arrays.copyOfRange(a, 1, a.length));

return (a[0] < x ? a[0] : x);

}
0%
0%
0%
0%
0%
View this question
View this question

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

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

Browser

Add to Chrome