How would you use hash tables and trees for efficient retrieval of configuration settings or lookup tables?