struct data{data *next; tree *elem; int i;};
struct list{data *begin, *end;};
//Функция создания очереди
void creatoch(list *och)
{
och->begin=NULL;
och->end=NULL;
}
//Добавить элемент в очередь
void intooch(list *och, tree *elem,int i)
{
data *p;
p=new data;
p->next=NULL;
p->elem=elem;
p->i=i;
if(och->begin==NULL&&och->end==NULL)
och->begin=p;
else
och->end->next=p;
och->end=p;
}
//Взять элемент из очереди
int outoch(list *och, tree **elem, int *i)
{
data *p;
if(och->begin!=NULL)
{
*elem=och->begin->elem;
*i=och->begin->i;
p=och->begin;
if(och->begin==och->end)
och->begin=och->end=NULL;
else
och->begin=och->begin->next;
delete p;
return 1;
} else return 0;
}
//Проверить пуста ли очередь
int nulloch(list *och)
{
if(och->begin!=NULL&&och->end!=NULL) return 0; else return 1;
}