Chèn 1 pt có gt khóa x

Màu nền
Font chữ
Font size
Chiều cao dòng

int RemoveList &l, int x)

    {    Node *p,*q = NULL; p=l.pHead;

        while((p!=NULL)&&(p->Info!=x)) //tìm

        {    q=p;

            p=p->pNext;

        }

        if(p==NULL)        //không tìm thay phan tu có khoá bang x

            return 0;

        if(q!=NULL)//tìm thay phan tu có khoá bung x

        {

            if (p==l.pTail) l.pTail=q;

            q->pNext=p->pNext;

            delete p;

        }   

        else //phan tu can xoá nam dau List

        RemoveHead;

        return 1;

    }

Bạn đang đọc truyện trên: Truyen2U.Pro