23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure 3.18: Remov<strong>in</strong>g the node stor<strong>in</strong>g PVD: (a)<br />

before the removal; (b) l<strong>in</strong>k<strong>in</strong>g out the old node; (c)<br />

after the removal (<strong>and</strong> garbage collection).<br />

3.3.3 An Implementation of a Doubly L<strong>in</strong>ked List<br />

In Code Fragments 3.22–3.24 we show an implementation of a doubly l<strong>in</strong>ked list<br />

with nodes that store character str<strong>in</strong>g elements.<br />

Code Fragment 3.22: <strong>Java</strong> class DList for a doubly<br />

l<strong>in</strong>ked list whose nodes are objects of class DNode (see<br />

Code Fragment 3.17) stor<strong>in</strong>g character str<strong>in</strong>gs.<br />

(Cont<strong>in</strong>ues <strong>in</strong> Code Fragment 3.23.)<br />

176

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!