<mình muốn hiện thêm dòng dãy khóa đầu với lại dòng dãy khóa sau khi sắp xếp vào. Ai biết giúp mình với>

#include <stdio.h>

#include <stdlib.h>

#include <conio.h>

#include <dos.h>

#include <string.h>

#include <math.h>

typedef struct node{

int infor;

struct node *next;

} *NODEPTR;

void Init(NODEPTR *plist){

*plist = NULL;

}

int IsEmpty(NODEPTR *plist){

if (*plist == NULL)

return 1;

return 0;

}

NODEPTR Getnode(void){

NODEPTR p;

p = (NODEPTR)malloc(sizeof(struct node));

return(p);

}

void Inserttop(NODEPTR *plist, int x){

NODEPTR p;

p = Getnode();

p->infor = x;

if (IsEmpty(plist) == 1){

p->next = NULL;

*plist = p;

return;

}

p->next = *plist;

*plist = p;

}

void Input(NODEPTR *plist)

{

int n, x, i;

printf("Nhap so pt cua ds: \t");

scanf("%d", &n);

for (i = 0; i<n; i++)

{

printf("Nhap gia tri: \t");

scanf("%d", &x);

Inserttop(plist, x);

}

}

void Freenode(NODEPTR p){

free(p);

}

void output(NODEPTR plist)

{

NODEPTR p;

p = plist;

if (IsEmpty(&plist) == 1)

{

printf("\n Danh sach rong");

return;

}

while (p != NULL)

{

printf("\n%-5d % -20s", p->infor);

p = p->next;

}

Freenode(p);

}

//

void Sortnode(NODEPTR *plist){

NODEPTR p, q; int temp;

for (p = *plist; p != NULL; p = p->next){

for (q = p->next; q != NULL; q = q->next){

if (p->infor>q->infor){

temp = p->infor; p->infor = q->infor;

q->infor = temp;

}

}

}

printf("\n Danh sach duoc sap xep");

for (p = *plist; p != NULL; p = p->next)

{

printf("\n%-5d % -20s", p->infor);

}

Freenode(p);

}

int main(){

NODEPTR plist;

Init(&plist);

Input(&plist);

output(plist);

Sortnode(&plist);

getch();

return 0;

}