Advertisement

create an algorithm to delete every node in a single linked list with value x

阅读量:

思路1:

假定所处理的单链表包含头结点,采用尾插法构建一个新的单链表,将所有不等于x的数值元素纳入其中。

代码1:

复制代码
 void delAllSame(LNode *&L,int x){//用尾插法建立一个新的单链表,将值不为x的元素链接到表尾

全部评论 (0)

还没有任何评论哟~