Java Reference
In-Depth Information
Chapter
3
A Bag Implementation
That Links Data
Contents
Linked Data
Forming a Chain by Adding to Its Beginning
A Linked Implementation of the ADT Bag
The Private Class Node
An Outline of the Class LinkedBag
Defining Some Core Methods
Testing the Core Methods
The Method getFrequencyOf
The Method contains
Removing an Item from a Linked Chain
The Methods remove and clear
A Class Node That Has Set and Get Methods
The Pros and Cons of Using a Chain to Implement the ADT Bag
Prerequisites
Chapter
1
Bags
Chapter
2
Bag Implementations That Use Arrays
Objectives
After studying this chapter, you should be able to
Describe a linked organization of data
Describe how to add a new node to the beginning of a chain of linked nodes
Describe how to remove the first node in a chain of linked nodes
Describe how to locate a particular piece of data within a chain of linked nodes
Implement the ADT bag by using a chain of linked nodes
Describe the differences between the array-based and linked implementations of the ADT bag
 
Search WWH ::




Custom Search