previous | start | next

Orered Symbol Table

The symbol table methods presented above don't provide any way of accomplishing this. In particular the compareTo method can't be used on the generic type Key since it isn't declared to implement Comparable<Key>.

Requiring the Key type to be Comparable is a restriction. So instead a new abstract data type is needed: ordered symbol table that requires Key to be a comparable type.

With this restriction, additional methods make sense and can be used to address problems such as finding the "nearest" key.



previous | start | next