const buckets = 20; type domain = char; range = integer; mapcell = record d : domain; r : range; end; listelement = mapcell; listlink = ^listcell; listcell = record left : listlink; right : listlink; element : mapcell; end; list = ^listcell; listposition = listlink; bucket = list; map = array[0..buckets] of bucket; function maphash(d : domain):integer; {+--- on entry - d exists and is a single character | on exit - maphash contains a number between 1 and maphashbuckets +-----------------------------------------------------------------------} begin maphash := ord(d) mod buckets; end; function compare(e1,e2 : listelement):integer; {+--- on entry - e1 and e2 are transfered in for a comparison | on exit - compare returns +1 iff e1 > e2 | 0 iff e1 = e2 | -1 iff e1 < e2 +----------------------------------------------------------------------} begin {compare} if e1.d > e2.d then compare := 1 else if e1.d < e2.d then compare := -1 else compare := 0; end; {compare} procedure print(var out:text; e:listelement); {+--- on entry - e is contained in the list and is ready for output | on exit - e has been written to the corresponding out file +------------------------------------------------------------------------} begin {print} writeln (out,e.d:4,' 'e.r:4); end; {print} .