Saralash masalasi Eng yaqin yo’lni toppish masalasi


Download 35.94 Kb.
bet3/14
Sana05.05.2023
Hajmi35.94 Kb.
#1430665
1   2   3   4   5   6   7   8   9   ...   14
Bog'liq
Algoritmlarni loyihalash” fanidan 1-oraliq nazorat uchun test sa

2-ON_AL.

  1. Quyidagi funksiya nima vazifani bajaradi?

int funk(int *a, int l, int r)
{
return l == r ? a[l] : funk(a, l, (l + r)/2) + funk(a, (l + r)/2 + 1, r);
}
..
{
funk(a, 0, N - 1);
}
Select one:

    1. a massivning elementlari yig'indisini hisoblaydi

  1. Quyidagi dastur natijasini aniqlang

int funk(int *a, int l, int r)
{
int x1, x2;
if (l == r)
return a[l]; else
{
x1 = funk(a, l, (l + r)/2); x2 = funk(a, (l + r)/2 + 1, r);
return x1 > x2 ? x1 : x2;
}
}
int main()
{
int a[]={2,9,7,5,6};
cout<}
9

  1. Richard Bellman tomonidan birinchi martta qaysi tushuncha ishlatilgan?

Select one:

    1. "Dinamik dasturlash" tushunchasi

  1. Quydagi tasodifiy algoritm yordamida qidirish usuli qanday nomlanadi?

int a[11]={2,4,5,8,23,4,54,65,3,14,20};
do
{
b=rand()%11;
} while (c!=a[b]); //c - izlanayotgan son
cout<Select one:

    1. Las-Vegas

  1. Quyidagi dastur natijasini aniqlang

int funk(int *a, int l, int r)
{
int x1, x2;
if (l == r)
return a[l]; else
{
x1 = funk(a, l, (l + r)/2); x2 = funk(a, (l + r)/2 + 1, r);
return x1 < x2 ? x1 : x2;
}
}
int main()
{
int a[]={2,7,7,5,6,5,4,3,6,7,8};
cout<}
2

  1. Dinamik dasturlash odatda muammolarni yechishda nechta

Select one:

    1. 2

  1. Rand() funksiyasi qanday oraliqdagi butun tasodifiy sonlarni qaytaradi?

Select one or more:


    1. Download 35.94 Kb.

      Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   ...   14




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling