Professional Documents
Culture Documents
DANHSACHLIENKET
DANHSACHLIENKET
h>
#include <stdlib.h>
struct Node
int info;
};
//khoi tao
phead = NULL;
return(phead == NULL);
//tao node
node createNode(int x)
node p = (node)malloc(sizeof(node));
p->info = x;
p->next = NULL;
return p;
// chen dau
node p = createNode(x);
if (isEmpty(phead))
phead = p;
else {
p->next = phead;
phead = p;
//Chen cuoi
node tmp, p;
tmp = createNode(x);
if (isEmpty(phead))
phead = tmp;
else
p = phead;
p = p->next;
p->next = tmp;
node tmp, p;
if (position == 0 || isEmpty(phead))
{
insertFirst(phead, x);
else
int k = 1;
p = phead;
p = p->next;
k++;
if (k != position)
insertLast(phead, x);
else
tmp = createNode(x);
tmp->next = p->next;
p->next = tmp;
init(phead);
int x, n;
scanf("%d", &n);
scanf("%d", &x);
insertFirst(phead, x);
int main()
node phead;
input(phead);
show(phead);
return 0;