Array-Based Structures

This chapter discusses general-purpose array-based structures. Each of these classes has an array as a field. We present implementations of the Stack and Queue interfaces from Chapter 4, as well as a new interface List and one implementation of it.

An array has a fixed lengthit can't get any longer or shorter. Section 5.1 presents techniques for getting around this problem, in the context of developing a class to represent a deck of playing cards.

Section 5.2 shows how to implement the Stack and Queue interfaces. Section 5.3 presents the List interface and the ArrayList class which implements it. The Iterator interface, explained in Section 5.4, is a general-purpose technique for traversing a Listthat is, doing something with or to each element of the List.

These structures are so commonly used that standard implementations are built into Java. Section 5.5 introduces the Java collections framework, which provides many useful general-purpose data structures.


Part I: Object-Oriented Programming

Encapsulation

Polymorphism

Inheritance

Part II: Linear Structures

Stacks and Queues

Array-Based Structures

Linked Structures

Part III: Algorithms

Analysis of Algorithms

Searching and Sorting

Recursion

Part IV: Trees and Sets

Trees

Sets

Part V: Advanced Topics

Advanced Linear Structures

Strings

Advanced Trees

Graphs

Memory Management

Out to the Disk

Part VI: Appendices

A. Review of Java

B. Unified Modeling Language

C. Summation Formulae

D. Further Reading

Index



Data Structures and Algorithms in Java
Data Structures and Algorithms in Java
ISBN: 0131469142
EAN: 2147483647
Year: 2004
Pages: 216
Authors: Peter Drake

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net