Информатика и технология программирования


Вопросы без ответов - часть 3


void *F( sxxx *p, PCMP pf)
{
xxx *q;
vois *s;
for (s=p-&#62ph-&#62data; p != NULL; p = p-&#62next)
for ( q = p-&#62ph; q!=NULL; q=q-&#62next)
if ((*pf)(s,q-&#62data))==-1) s=q-&#62data;
return s;
}
//------------------------------------------------------ 17


typedef int (*PCMP)(void*, void*);
struct xxx { void **data; xxx *next; };
void *F( mxxx *p, PCMP pf)
{
void **q;
void *s;
for (s=p-&#62data[0]; p != NULL; p = p-&#62next)
for (q = p-&#62data; *q != NULL; q++)
if ((*pf)(s,*q)==-1) s = *q;
return s;
}
//------------------------------------------------------ 18


typedef int (*PCMP)(void*, void*);
void *F(void ***p, PCMP pf)
{
void **q, *s;
for (s=p[0][0]; *p != NULL; p++)
for (q = *p; *q != NULL; q++)
if ((*pf)(s,*q)==-1) s = *q;
return s;
}
//------------------------------------------------------ 19


typedef int (*PCMP)(void*, void*);
void *F(void *p, int sz, int n, PCMP pf)
{
char *q;
void *s;
for (q = p, s = p; n &#62 0; n--, q+=sz)
if ((*pf)(s,q)==-1) s=q;
return s;
}
//------------------------------------------------------ 20


typedef int (*PCMP)(void*, void*);
struct xxx { void *data; xxx **link; };
void *F( xxx *p, void PCMP pf)
{
xxx **q;
void *s,*r;
if (p==NULL) return NULL;
s = p-&#62data;
for (q = p-&#62link; *q != NULL; q++)
{
r=F(*q,pf);
if (r!=NULL &#38&#38 (*pf)(s,r)==-1) s=r;
}
return r;
}
//------------------------------------------------------ 21


typedef int (*PCMP)(void*, void*);
struct xxx { void *data; xxx *next,*pred; };
void *F( xxx *p, PCMP pf)
{
xxx *q;
void *s;
if (p==NULL) return NULL;
q = p; s = p-&#62data;
do {
if ((*pf)(s,q-&#62data))==-1) s=q-&#62data;
q = q-&#62next;
} while (q != p);
return s;
}
//------------------------------------------------------- 22


typedef int (*PCMP)(void*, void*);
void F(void *p[], void PCMP pf)
{
int i,k;
do {
k=0;
for (i=1;p[i]!=NULL; i++)
if ((*pf)(p[i-1],p[i] &#62 0))
{ void *s = p[i-1];
p[i-1]=p[i];
p[i]=s; k++;
}
} while(k);
}
//------------------------------------------------------- 23


typedef int (*PCMP)(void*, void*);
void F(void *p[], void PCMP pf, void *q)
{ int i,j;
for (i=0; p[i]!=NULL &#38&#38 (*pf)(p[i],q) &#60 0; i++);
for (j=0; p[j]!=NULL; j++);
for (; j&#62=i; j--) p[j+1]=p[j];
p[i]=q;
}
//------------------------------------------------------ 24


typedef int (*PCMP)(void*, void*);
struct xxx { void *data; xxx *next; };
void F( xxx **p, PCMP pf, void *q)
{
xxx *s;
for (; *p!=NULL &#38&#38 (*pf)((*p)-&#62data,q) &#60 0; p = &#38(*p)-&#62next);
s = new xxx;
s-&#62data = q;
s-&#62next = (*p)-&#62next;
*p = s;
}




Начало  Назад  Вперед



Книжный магазин