.該算法的功能是判斷鏈表L是否是非遞減有序若是則返回true;否則返回falsepre指向當前結點p指向pre的後繼
.q=p>next; p>next=q>next; free(q);
設單鏈表的頭結點的頭指針為head且pre=head;
while(pre>next!=p) pre=pre>next;
s>next=p; pre>next=s;
設單鏈表帶頭結點工作指針p初始化為p=H>next;
() while(p!=null && p>data!=X) p=p>next;
if(p= =null) return(null);∥查找失敗
else return(p);∥查找成功
() while(p!=null && p>data<X ) p=p>next;
if(p==null || p>data>X) return(null);∥查找失敗
else return(p);
() while(p!=null && p>data>X) p=p>next;
if(p==null || p>data<X) return(null); ∥查找失敗
else return(p); ∥查找成功
本程序段功能是將pa和pb鏈表中的值相同的結點保留在pa鏈表中(pa中與pb中不同結點刪除)pa是結果鏈表的頭指針鏈表中結點值與從前逆序S記結果鏈表中結點個數(即pa與pb中相等的元素個數)S記原pa鏈表中刪除的結點個數
[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
From:http://tw.wingwit.com/Article/program/sjjg/201311/23363.html