An Array v's A Dictionary - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +--- Thread: An Array v's A Dictionary (/showthread.php?tid=3105) Pages:
1
2
|
RE: An Array v's A Dictionary - TempodiBasic - 10-08-2024 (10-07-2024, 07:18 PM)Dimster Wrote: I've just recently come across a Dictionary as an alternative to an Array. Doesn't appear that QB64PE supports Dictionaries. Does anyone who codes in languages which do use Dictionaries find them the same as using an Array or better than an Array or offering a completely different manipulation of data than an Array? Hi Dimster we must remember the differences between array and dictionary -array is a set of data of the same type of data in which elements are ordered by value of index of array that is a integer number array definition, rosetta code Array QB64 Rosetta code example -dictionary is an associative array in which each element has a key and a value, so searching for the key you get back the value here a dictionary made using a string as container and delimiter characters to separate the couple Key-Value rosetta code associative array QB64 and here the task definition of type of data Associative array So we can think that dictionary mustn't keep ordered (increasing or decreasing) the Key side of the couple Key-Value and the search has been made looking from the start to the end of the dictionary in the Key side. A more evolute dictionary is a hashmap in which the Key value has direct access to the Value using a Hash formula. In the forum you can find example of dictionary, associative arrays and hash formula. But that posted by Bplus is a good start. |