On Jun 28, 2006, at 8:12 PM, [EMAIL PROTECTED] wrote:

I am updating some integer codes, for example
111 ->    333
121   -> 444
etc.

Is a dictionary the best programming way to do this?

its seems i define D as new dictionary
D.value( 121 ) = 444
etc.

Or is this overkill?

It looks like you are doing an integer lookup table. It depends on the size of the data you are looking to use whether a dictionary would be the most efficient.

An array would always be faster if you have enough memory to hold all of the data in the set. For example, a text substitution cipher would use an array of 256 elements and scramble the values. A second array would provide the data in the decoding direction.

Arrays are great for data which is compressed into a small set of numbers like 0-255, 0-1024, 0-16384, but not so great for millions of items or keys that have large values.

If you have 1000 elements and the values range from 0 to 4,294,967,296, then the dictionary is the most efficient in terms of memory.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to