📄 勘误(数据结构).htm
字号:
<P><SPAN>
</SPAN> p:=p^.next;</P>
<P><SPAN>
</SPAN> WHILE pre^.data = p^.data
DO</P>
<P><SPAN>
</SPAN> BEGIN</P>
<P><SPAN>
</SPAN> pre^.next:=p^.next;</P>
<P><SPAN>
</SPAN> dispose(p);</P>
<P><SPAN>
</SPAN> p:=pre^.next</P>
<P><SPAN>
</SPAN> END;</P>
<P><SPAN> </SPAN>END</P>
<P><SPAN lang=EN-US><![if !supportEmptyParas]><![endif]>
<O:P></O:P></SPAN></P>
<P><SPAN lang=EN-US>PROCEDURE Conjunct(VAR HA, HB, HC:
linklist);</SPAN></P>
<P>VAR PreA, PreB, PreC, PA, PB, PC, Pt: linklist;</P>
<P><SPAN lang=EN-US>BEGIN</SPAN></P>
<P><SPAN> </SPAN>PreA:=HA;</P>
<P><SPAN> </SPAN>PreB:=HB;</P>
<P><SPAN> </SPAN>PreC:=HC;</P>
<P><SPAN> </SPAN>PA:=HA^.next;</P>
<P><SPAN> </SPAN>PB:=HB^.next;</P>
<P><SPAN> </SPAN>PC:=HC^.next;</P>
<P><SPAN> </SPAN>WHILE PA<>NIL
AND PB<>NIL AND PC<>NIL DO</P>
<P><SPAN>
</SPAN>IF PA^.data=PB^.data AND PB^.data =PC^.data THEN</P>
<P> BEGIN</P>
<P><SPAN>
</SPAN> Skip(PreA, PA);</P>
<P><SPAN>
</SPAN> PreB:=PB;</P>
<P><SPAN>
</SPAN> PreC:=PC;</P>
<P><SPAN>
</SPAN> PB:=PB^.next;</P>
<P><SPAN>
</SPAN> PC:=PC^.next</P>
<P> END</P>
<P><SPAN>
</SPAN>ELSE</P>
<P><SPAN>
</SPAN> IF PA^.data<=PB^.data AND
PA^.data<=PC^.data THEN</P>
<P><SPAN>
</SPAN> MoveNext(PreA, PA);</P>
<P><SPAN>
</SPAN> ELSE</P>
<P><SPAN>
</SPAN> IF PB^.data<=PA^.data AND
PB^.data<=PC^.data THEN</P>
<P><SPAN>
</SPAN>
BEGIN</P>
<P><SPAN>
</SPAN>
PreB:=PB;</P>
<P><SPAN>
</SPAN>
PB:=PB^.next;</P>
<P><SPAN>
</SPAN>
END;</P>
<P><SPAN>
</SPAN> ELSE</P>
<P><SPAN>
</SPAN>
IF PC^.data<=PA^.data AND PC^.data<=PB^.data THEN</P>
<P><SPAN>
</SPAN>
BEGIN</P>
<P><SPAN>
</SPAN>
PreC:=PC;</P>
<P><SPAN>
</SPAN>
PC:=PC^.next;</P>
<P><SPAN>
</SPAN>
END;</P>
<P><SPAN> </SPAN>IF PA<>NIL THEN
PreA^.next=NIL;</P>
<P style="TEXT-INDENT: 21pt"><SPAN lang=EN-US>WHILE PA<>NIL
DO</SPAN></P>
<P style="TEXT-INDENT: 21pt"><SPAN>
</SPAN>BEGIN</P>
<P style="TEXT-INDENT: 21pt"><SPAN>
</SPAN> PreA:=PA;</P>
<P><SPAN>
</SPAN> PA:=PA^.next;</P>
<P><SPAN>
</SPAN> Dispose(PreA)</P>
<P><SPAN>
</SPAN>END;</P>
<P><SPAN lang=EN-US>END.</SPAN></P>
<P><SPAN lang=EN-US><![if !supportEmptyParas]><![endif]>
<O:P></O:P></SPAN></P>
<P><SPAN> </SPAN><SPAN
style="FONT-FAMILY: 宋体">最后说明,由于每个链表均只遍历一次,因此可以保证题目中的时间复杂度要求。</SPAN></P>
<P><SPAN lang=EN-US><![if !supportEmptyParas]><![endif]>
<O:P></O:P></SPAN></P></DIV>
<P></P></TD></TR></TBODY></TABLE></DIV>
<DIV align=center><!-- #BeginLibraryItem "/Library/bot.lbi" -->
<DIV align=center></DIV>
<TABLE height=45 cellSpacing=0 cellPadding=0 width=640 align=center border=0><!-- fwtable fwsrc="Untitled" fwbase="k1.jpg" -->
<TBODY>
<TR><!-- Shim row, height 1. -->
<TD><IMG height=1 src="勘误(数据结构).files/shim.gif" width=290 border=0></TD>
<TD><IMG height=1 src="勘误(数据结构).files/shim.gif" width=1 border=0></TD>
<TD><IMG height=1 src="勘误(数据结构).files/shim.gif" width=238 border=0></TD>
<TD><IMG height=1 src="勘误(数据结构).files/shim.gif" width=9 border=0></TD>
<TD><IMG height=1 src="勘误(数据结构).files/shim.gif" width=1 border=0></TD>
<TD><IMG height=1 src="勘误(数据结构).files/shim.gif" width=101 border=0></TD>
<TD><IMG height=1 src="勘误(数据结构).files/shim.gif" width=1 border=0></TD></TR>
<TR vAlign=top><!-- row 1 -->
<TD vAlign=bottom align=middle bgColor=#000000 colSpan=3 height=25>
<DIV align=center>
<P><SPAN class=txtcopy>版权所有1999-2001,北京前沿时代科技有限公司<BR><FONT
face="Arial, Helvetica, sans-serif"><A
href="file:///E|/index_im.htm"><FONT
color=#cccccc>http://www.artech.com.cn</FONT></A> Email:<A
href="mailto:towen@21cn.com"><FONT
color=#cccccc>towen@21cn.com</FONT></A> Tel(Fax):</FONT></SPAN><SPAN
class=txtcopy><FONT
face="Arial, Helvetica, sans-serif">(010)68732263</FONT></SPAN></P></DIV></TD>
<TD bgColor=#000000 colSpan=3 height=25><IMG height=34
src="勘误(数据结构).files/k1_r1_c4.jpg" width=111 border=0 name=k1_r1_c4></TD>
<TD height=25><IMG height=34 src="勘误(数据结构).files/shim.gif" width=1
border=0></TD></TR><!-- This table was automatically created with Macromedia Fireworks 3.0 --><!-- http://www.macromedia.com --></TBODY></TABLE><!-- #EndLibraryItem --></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -