Saralash masalasi Eng yaqin yo’lni toppish masalasi


O(NlogN) Rand() funksiyasidan foydalanish uchun Ctime header fayli chaqiriladi 'False'


Download 35.94 Kb.
bet11/14
Sana05.05.2023
Hajmi35.94 Kb.
#1430665
1   ...   6   7   8   9   10   11   12   13   14
Bog'liq
Algoritmlarni loyihalash” fanidan 1-oraliq nazorat uchun test sa

O(NlogN)

  1. Rand() funksiyasidan foydalanish uchun Ctime header fayli chaqiriladi

'False'.

  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<}
7

  1. Quyidagi dastur kodini tahlil qiling:

char combination[]={'a','b','c'};
void generate(int m)
{
int n, i;
if (m+1 > m_max)
{
for (i=0; icout<cout<}
else
for (n=0; nif (m == 0||n > m-1)
{
combination[m] = combination[n];
generate(m + 1);
};}; 
Select one:
{a,b,c} hosil qilish masalasining dastur kodi

  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. srand(seed) funksiyasida seedning qiymati dastlabki holatda nimaga teng?

Select one or more:

    1. 1 ga

  1. Biror chekli to’plam elementlari ichida ma’lum bir xossaga ega bo’lgan elementlaridan iborat qism to’plamlarni tanlab olish yoki to’plam elementlarini ma’lum bir tartibda joylashtirish bilan bog’liq masalalar Answer(aaaaa masalalar)


Download 35.94 Kb.

Do'stlaringiz bilan baham:
1   ...   6   7   8   9   10   11   12   13   14




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