#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
typedef struct tagnode
{
int info;
tagnode *next;
}node;
typedef node *list;
list dau,cuoi;
node *khoitaonode(int gt)
{
node *x;
x=(node*)malloc(sizeof(node));
if(x==NULL)
{
printf("Deo co bo nho.");
exit;
}
x->info=gt;
x->next=NULL;
return x;
}
node *timkiem(list &dau, int k)
{
node *x;
x=dau;
while((x!=NULL)&&(x->info!=k)) x=x->next;
return x;
}
void themdau(list &dau, list &cuoi, node *ptu)
{
if(dau==NULL)
cuoi=ptu;
else
ptu->next=dau;
dau=ptu;
}
void themcuoi(list &dau, list &cuoi, node *ptu)
{
if(dau==NULL)
dau=ptu;
else
cuoi->next=ptu;
cuoi=ptu;
}
void thembatki(int k, node *ptu)
{
node *x=d