Cover Data Structures and Algorithms with Object-Oriented Design Patterns in Java
next up previous contents index

Implementation

Program gif declares the TwoWayMergeSorter class. The TwoWayMergeSorter class extends the AbstractSorter class defined in Program gif. A single field, tempArray, is declared. This field is an array of Comparable objects. Since merge operations cannot be done in place, a second, temporary array is needed. The tempArray field keeps track of that array.

   program44003
Program: TwoWayMergeSorter fields.


next up previous contents index

Bruno Copyright © 1998 by Bruno R. Preiss, P.Eng. All rights reserved.