2 ms·
What is a array index if not a “pointer”? In fact, access an array member involves a pointer arithmetic: array_p + index * data_size The fact that traditional
by sinuhe69 3y ago
What is a array index if not a “pointer”? In fact, access an array member involves a pointer arithmetic:
array_p + index * data_size
The fact that traditional tree implementation requires malloc is solely based on the wish to dynamically provide and remove of nodes. If the tree can have a limited size with no frequent delete operation, an array implementation is fine. Otherwise, expand an array can be a very costly or even an impossible operation in some circumstances.
And full scanning is not efficient.
- kleiba 3y agoThe difference lies in the CPU cache.