adding algorithm for using tries to implement dictionary lookup