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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Once we have identified the place <strong>in</strong> the entries array where the new game<br />

entry, e, belongs, we add a reference to e at this position. That is, cont<strong>in</strong>u<strong>in</strong>g our<br />

visualization of object references as remote controls, we add a remote control<br />

designed especially for e to this location <strong>in</strong> the entries array. (See Figure 3.3.)<br />

Figure 3.3: Add<strong>in</strong>g a reference to a new<br />

GameEntry object to the entries array. The<br />

reference can now be <strong>in</strong>serted at <strong>in</strong>dex 2, s<strong>in</strong>ce we<br />

have shifted all references to GameEntry objects with<br />

scores less than the new one to the right.<br />

145

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

Saved successfully!

Ooh no, something went wrong!