<<Is a map accessed via indices or will "ID" be the actual ID? I mean, there
can be a file with four blocks, with IDs 10, 500, 225 and 7. Now, can I
still call blocks[type][500] w/o needing the map be large enough to hold
500 blocks?>>

"ID" will be the actual ID. Maps are generally implemented as red/black 
binary trees. This means that when you look for "ID" 500, it just traverses 
the tree and finds a node with the value 500. This is very fast since 
red/black trees balance themselves as you add and delete nodes. For example, 
a balanced binary tree with 500 items will find any item in at most 9 steps, 
since it can hold 2^9 = 512 nodes in it's 9 levels. It finds the item by the 
rule that all nodes with a lesser index fall to the left, and all nodes with 
a greater index fall to the right.
e.g:

            5
        /       \
      3         7
    /  \      /  \
   2    4   6    8

Anyway, probably more info that you wanted... but to answer your second 
question, nodes are only allocated as needed, so can call blocks[type][500] 
even if your map has only one entry at slot 500.

Brian

Reply via email to