-
Notifications
You must be signed in to change notification settings - Fork 2
hashed
bergsma edited this page Jul 31, 2014
·
2 revisions
Any variable can be made hashed or unhashed. When a variable is hashed, it means that access to its elements is done through a hash table. A hash table is useful when the number of elements for a variable (or member variable) are large in number and unique in name.
A personnel list is an ideal data structure to hash. For example:
list Jack = {
ushort extension = 1234,
int birthday = "10/01/1963"
};
list Cathy = {
ushort extension = 5678,
int birthday = "06/23/1962"
};
/* ... */
list empTable;
hashed empTable;
append ( empTable, Jack );
append ( empTable, Cathy );
/* ... */
_
When the number of employees grows large, it will be more efficient to access the hashed empTable by member name (e.g. empTable.Cathy) than by index, such as empTable[i]. In the above example, if empTable was not hashed, then access to empTable.Cathy would be even poorer performance than through empTable[i].