Compare the efficiency of using a hash map versus a balanced tree for this specific data retrieval task.