![]() Unfortunately, naming conventions for most objects are not so convenient, and even enumerations like Social Security numbers are likely to span a larger range than we want to allocate. Basics of hashingIf our keys were conveniently named 0, 1, 2., n-1, we could simply use an array, and be able to find a record given a key in constant time. For example, we could implement the dictionary as an array of structs that we search through, but that would be expensive: O(n) time to find a key in the worst case.2. User title = dictCreate dictSet( title, ' Barack ', ' President ') user = ' Barack ' printf( ' Welcome%s%s n ', dictGet( title, user), user) As with other abstract data types, the idea is that the user of the dictionary type doesn't need to know how it is implemented. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |