InterviewSolution
Saved Bookmarks
| 1. |
When are dictionaries more useful than lists ? |
|
Answer» Dictionaries can be much more useful than lists. For example : suppose we wanted to store all our friend’s cell phone numbers. We could create a list of pairs (phone number, name), but once this list becomes long enough searching this list for a specific phone number will get time consuming. Better would be if we could index the list by our friend’s name. This is precisely what a dictionary does. |
|