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.

true<br />

( )<br />

enqueue(9)<br />

-<br />

(9)<br />

enqueue(7)<br />

-<br />

(9, 7)<br />

size()<br />

2<br />

(9, 7)<br />

enqueue(3)<br />

-<br />

(9, 7, 3)<br />

enqueue(5)<br />

-<br />

(9, 7, 3, 5)<br />

dequeue( )<br />

9<br />

(7, 3, 5)<br />

Example Applications<br />

There are several possible applications for queues. Stores, theaters, reservation<br />

centers, <strong>and</strong> other similar services typically process customer requests accord<strong>in</strong>g<br />

to the FIFO pr<strong>in</strong>ciple. A queue would therefore be a logical choice for a data<br />

structure to h<strong>and</strong>le transaction process<strong>in</strong>g for such applications. For example, it<br />

would be a natural choice for h<strong>and</strong>l<strong>in</strong>g calls to the reservation center of an airl<strong>in</strong>e<br />

or to the box office of a theater.<br />

287

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

Saved successfully!

Ooh no, something went wrong!