链表
参考:https://www.cnblogs.com/xnwyd/archive/2010/04/28/1723151.html
插入节点:
set a=[a1,a2......ai-1,ai+1......an-1,an]
display data from head
ai-1=p
ai+1=q
p->next=q
if data=ai
ai=x
x->next=q
p->next=x
if data=null
write a
删除节点:
set a=[a1,a2......ai-1,ai,ai+1......an-1,an]
ai-1=p
ai=t
ai+1=q
p->next=t
t->next=q
display data from head
if data=ai
t->next=p->next
p->next=q
if data=null
write a
posted on 2021-11-09 20:35 20211426赵炫宇 阅读(28) 评论(0) 编辑 收藏 举报