4 ms·
The first version always leaves a "clean" state, that is both indices points to actual array locations. A mentally "clean" state makes understanding easier. For
by hzhou321 10y ago
The first version always leaves a "clean" state, that is both indices points to actual array locations. A mentally "clean" state makes understanding easier. For the third version one has to keep in mind the wrap around behavior of computer specific integers throughout the comprehension process, so it is a bit more difficult (to understand).
- kbenson 10y agoThe third version also allows for the write index to be a counter of total store operations, at least until overflow, which could be useful.