Data Structures and Algorithms
with Object-Oriented Design Patterns in C# |
Program defines the constructor, Length property, and Purge methods of the ChainedScatterTable class. The constructor takes a single argument which specifies the size of scatter table desired. It creates an array of the desired length and initializes each element of the array by assigning to it an new Entry instance. Consequently, the running time for the ChainedScatterTable constructor is O(M) where M is the size of the scatter table.
Program: ChainedScatterTable class constructor, Length, and Purge methods.
The Length property provides a get accessor that returns the length of the array field. Clearly, its running time is O(1).
The Purge method empties the scatter table by assigning null values to each entry in the table. the time required to purge the scatter table is O(M), where M is the length of the table.