Update LinkList_with_head.cpp

https://github.com/huihut/interview/issues/34
This commit is contained in:
huihut 2019-03-29 00:03:10 +08:00
parent 04650523b3
commit 7f5fe39580

View File

@ -78,7 +78,10 @@ Status EnQueue_LQ(LinkList &L, ElemType &e) {
if (NULL == L) return OVERFLOW; if (NULL == L) return OVERFLOW;
L -> next = q; L -> next = q;
} }
else if (NULL == L->next) L = q; else if (NULL == L->next)
{
L -> next = q;
}
else else
{ {
p = L; p = L;
@ -106,6 +109,7 @@ Status DeQueue_LQ(LinkList &L, ElemType &e) {
//遍历调用 //遍历调用
Status visit(ElemType e) { Status visit(ElemType e) {
printf("%d\t", e); printf("%d\t", e);
return OK;
} }
//遍历单链表 //遍历单链表