Documente Academic
Documente Profesional
Documente Cultură
Clasa a X-a
Algoritmi fundamentali de prelucrare a datelor structurate n tablouri
a.
for (i = 0; i < n - 1; i++)
for (j = i + 1; j < n; j++)
if (a[i] < a[j])
{
x = a[i];
a[i] = a[j];
a[j] = x;
}
c.
for (i = 0; i < n - 1; i++)
for (j = i + 1; j < n; i++)
if (a[i] > a[j])
{
x = a[i];
a[i] = a[j];
a[j] = x;
}
b.
for (i = 0; i < n - 1; i++)
for (j = i + 1; j < n; j++)
if (a[i] > a[j])
{
x = a[i];
a[i] = a[j];
a[j] = x;
}
d.
for (i = 0; i < n - 1; i++)
for (j = i + 1; j < n; i++)
if (a[i] < a[j])
{
x = a[i];
a[i] = a[j];
a[j] = x;
}