单链表插入和删除一个节点的伪代码算法
单链表插入一个节点
Write 'a1 a2 a3 ... ai-1 ai+1 ... an-1 an'
Read SingleLinkList
Set ai-1 as node P
Set ai+1 as node Q(#P——>next == Q)
Set ai as node t
Set P——>next to t
Set t——>next to Q
单链表删除一个节点
Write 'a1 a2 a3 ... ai-1 ai+1 ... an-1 an'
Read SingleLinkList
Set ai-1 as node P
Set ai as node t
Set ai+1 as node Q(#P——>next == t, t——>next == Q)
Set P——>next = Q
python的实现