Next | Hash Hash Hash | 19 |
Probably the easiest thing to do is a linked list:
contains(assoc_list, key) { while (assoc_list && assoc_list.key != key) assoc_list = assoc_list.next return assoc_list; }
get(assoc_list, key) { node = contains(assoc_list, key) if (node) return node.value else return Null }
store(&assoc_list, key, value) { node = contains(assoc_list, key) if (node) node.value = value else { newnode = new Node(key, value); newnode.next = assoc_list assoc_list = newnode } }
This is simple enough to do even in C
Even, God forbid, in FORTRAN
Next | 19 |