Академический Документы
Профессиональный Документы
Культура Документы
Chapter 23
Chapter Contents
Specifications for the ADT Queue Using a Queue to Simulate a Waiting Line
The Classes WaitLine and Customer
StockPurchase
Java Class Library: the Interface Queue Specifications of the ADT Deque
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Chapter Contents
Using a Deque to Compute the Capital Gain in a Sale of Stock Specifications of the ADT Priority Queue Using a Priority Queue to Compute the Capital Gain in a Sale of Stock Specifications of the ADT Priority Queue Using a Priority Queue to Track Your Assignments
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
All additions are at the back of the queue Front of queue has items added first
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Fig. 23-2 Queue of strings after (a) enqueue adds Jim; (b) Jess; (c) Jill; (d) Jane;
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Fig. 23-2 Queue of strings after (e) enqueue adds Joe; (f) dequeue retrieves, removes Jim; (g) enqueue adds Jerry; (h) dequeue retrieves, removes Jess.
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
We use a queue to
Record investment transactions
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Fig. 23-9 A queue of (a) individual shares of stock; (b) grouped shares.
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Methods provided
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Fig. 23-11 A comparison of the operations that add, remove, and retrieve the entries of a stack s, queue q, and a deque d; (a) add;
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Fig. 23-11 A comparison of the operations that add, remove, and retrieve the entries of a stack s, queue q, and a deque d; (b) remove;
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Fig. 23-11 A comparison of the operations that add, remove, and retrieve the entries of a stack s, queue q, and a deque d; (c) retrieve.
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
per share Click to view Constructor is changed new methods Accessor methods for new fields added
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X
Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved. 0-13-237045-X