Data Structures and Algorithms with Object-Oriented Design Patterns in Python
next up previous index

Implementation

The ChainedScatterTable class is introduced in Program gif. This class extends the abstract HashTable class introduced in Program gif. The scatter table is implemented as an array of Entry class instances. The Entry class is a nested class  defined within the ChainedScatterTable class.

   program11820
Program: ChainedScatterTable.Entry class __init__ method.

Each Entry instance has two instance attributes--_obj and _next. The former refers to an object. The latter indicates the position in the array of the next element of a chain. The value of the constant NULL will be used instead of zero to mark the end of a chain. The value zero is not used to mark the end of a chain because zero is a valid array subscript.


next up previous index

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