Ronald Fisher, Frenk Yates
Manfiy bo’lmagan butun sonlar massividan eng katta elementni toppish dasturini “Bo’lish va hukmronlik qilish” algoritmi yordamida aniqlashda algoritmning bahosi nimaga teng?
Select one:
O(NlogN)
Rand() funksiyasidan foydalanish uchun Ctime header fayli chaqiriladi
'False'.
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
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; i
cout<
cout<
}
else
for (n=0; n
if (m == 0||n > m-1)
{
combination[m] = combination[n];
generate(m + 1);
};};
Select one:
Do'stlaringiz bilan baham: |