📄 page177.html
字号:
<HTML>
<HEAD>
<TITLE>Linked List Implementation</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<img src="cover75.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cover75.gif" alt="Logo" align=right>
<b>Data Structures and Algorithms
with Object-Oriented Design Patterns in C++</b><br>
<A NAME="tex2html4097" HREF="page178.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page178.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="next_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/next_motif.gif"></A> <A NAME="tex2html4095" HREF="page167.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page167.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="up_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/up_motif.gif"></A> <A NAME="tex2html4089" HREF="page176.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page176.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/previous_motif.gif"></A> <A NAME="tex2html4099" HREF="page9.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page9.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/contents_motif.gif"></A> <A NAME="tex2html4100" HREF="page620.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page620.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="index_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/index_motif.gif"></A> <BR><HR>
<H2><A NAME="SECTION008120000000000000000">Linked List Implementation</A></H2>
<A NAME="seclistslistp"> </A>
<P>
This section presents a pointer-based implementation of ordered lists.
Program <A HREF="page168.html#proglist2h" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page168.html#proglist2h"><IMG ALIGN=BOTTOM ALT="gif" SRC="cross_ref_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/cross_ref_motif.gif"></A> declares the <tt>ListAsLinkedList</tt> class.<A NAME="tex2html345" HREF="footnode.html#10541" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/footnode.html#10541"><IMG ALIGN=BOTTOM ALT="gif" SRC="foot_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/foot_motif.gif"></A>
Like its array-based counterpart <tt>ListAsArray</tt>,
the <tt>ListAsLinkedList</tt> class is a concrete class
derived from the abstract base class <tt>List</tt>.
The sets of member functions comprising the public interfaces
of the <tt>ListAsArray</tt> and <tt>ListAsLinkedList</tt> classes are identical.
<P>
<P><A NAME="10542"> </A><A NAME="proglist4h"> </A> <IMG WIDTH=575 HEIGHT=219 ALIGN=BOTTOM ALT="program10118" SRC="img801.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/img801.gif" ><BR>
<STRONG>Program:</STRONG> <tt>ListAsLinkedList</tt> Class Definition<BR>
<P><BR> <HR>
<UL>
<LI> <A NAME="tex2html4101" HREF="page178.html#SECTION008121000000000000000" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page178.html#SECTION008121000000000000000">Member Variables</A>
<LI> <A NAME="tex2html4102" HREF="page179.html#SECTION008122000000000000000" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page179.html#SECTION008122000000000000000">Inserting and Accessing Items in a List</A>
<LI> <A NAME="tex2html4103" HREF="page180.html#SECTION008123000000000000000" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page180.html#SECTION008123000000000000000">Finding Items in a List</A>
<LI> <A NAME="tex2html4104" HREF="page181.html#SECTION008124000000000000000" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page181.html#SECTION008124000000000000000">Removing Items from a List</A>
<LI> <A NAME="tex2html4105" HREF="page182.html#SECTION008125000000000000000" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page182.html#SECTION008125000000000000000">Positions of Items in a List</A>
<LI> <A NAME="tex2html4106" HREF="page183.html#SECTION008126000000000000000" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page183.html#SECTION008126000000000000000">Finding the Position of an Item and Accessing by Position</A>
<LI> <A NAME="tex2html4107" HREF="page184.html#SECTION008127000000000000000" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page184.html#SECTION008127000000000000000">Inserting an Item at an Arbitrary Position</A>
<LI> <A NAME="tex2html4108" HREF="page185.html#SECTION008128000000000000000" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page185.html#SECTION008128000000000000000">Removing Arbitrary Items by Position</A>
</UL>
<HR><A NAME="tex2html4097" HREF="page178.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page178.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="next_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/next_motif.gif"></A> <A NAME="tex2html4095" HREF="page167.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page167.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="up_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/up_motif.gif"></A> <A NAME="tex2html4089" HREF="page176.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page176.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/previous_motif.gif"></A> <A NAME="tex2html4099" HREF="page9.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page9.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/contents_motif.gif"></A> <A NAME="tex2html4100" HREF="page620.html" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/html/page620.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="index_motif.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/index_motif.gif"></A> <P><ADDRESS>
<img src="bruno.gif" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/icons/bruno.gif" alt="Bruno" align=right>
<a href="javascript:if(confirm('http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/copyright.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/copyright.html'" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/copyright.html">Copyright © 1997</a> by <a href="javascript:if(confirm('http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/signature.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/signature.html'" tppabs="http://dictator.uwaterloo.ca/Bruno.Preiss/books/opus4/signature.html">Bruno R. Preiss, P.Eng.</a> All rights reserved.
</ADDRESS>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -