So lately I've been using a lot of maps which is I believe an alternate way of implementing something like a linked list, and may have some added advantages.
the std::map by the way is the python analog of the dictionary, and is a (if you ever get into database programming languages like SQL) relational data containment structure.
The idea is pretty simple, for any key value of the map there is a relational value paired to such structure.
simple idea:
mapA['apple'] = 'first choice';
mapB['orange'] = 'second choice';
demonstrates in pseudo code the idea of storing objects in a given map.
This data container in C++ by the way is the analog of python's dictionary.
A Map Tutorial
Stylistically I like using maps alternately to a linked list by the way (you can do this using an inverse map...that is keying the value on a inverse map and iterating a list, for example, to find a non key neighbor). This way I can blindly search reference a key value to find its value pair as opposed to iterating a linked list to find the key and then find its corresponding linked neighbor...but maybe there is a logical workaround to the problems (I haven't researched this honestly).
Secondly I like using maps in terms of diagnostics for data organization for tracing purposes (at least the human side) in seeing where failures in logic are occurring.
Thirdly they are as easy and nice to iterate as lists or arrays, but have the added advantage of eliminating control structures for iterate finding a value(s) from a key pair (relative to lists, arrays, vectors, and so forth).
Fourthly, they resemble data containers most closely aligned to the way our minds operate! :D
Example:
I remembered details of my wedding after hearing that song.
the std::map by the way is the python analog of the dictionary, and is a (if you ever get into database programming languages like SQL) relational data containment structure.
The idea is pretty simple, for any key value of the map there is a relational value paired to such structure.
simple idea:
mapA['apple'] = 'first choice';
mapB['orange'] = 'second choice';
demonstrates in pseudo code the idea of storing objects in a given map.
This data container in C++ by the way is the analog of python's dictionary.
A Map Tutorial
Stylistically I like using maps alternately to a linked list by the way (you can do this using an inverse map...that is keying the value on a inverse map and iterating a list, for example, to find a non key neighbor). This way I can blindly search reference a key value to find its value pair as opposed to iterating a linked list to find the key and then find its corresponding linked neighbor...but maybe there is a logical workaround to the problems (I haven't researched this honestly).
Secondly I like using maps in terms of diagnostics for data organization for tracing purposes (at least the human side) in seeing where failures in logic are occurring.
Thirdly they are as easy and nice to iterate as lists or arrays, but have the added advantage of eliminating control structures for iterate finding a value(s) from a key pair (relative to lists, arrays, vectors, and so forth).
Fourthly, they resemble data containers most closely aligned to the way our minds operate! :D
Example:
I remembered details of my wedding after hearing that song.
No comments:
Post a Comment