Data Structures in Typescript #11 - Circular Buffer Introduction

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

I guess its case dependent but wouldn't overwriting the data at the current readIndex lead to inconsistent results? For example, in the animated diagram of the circular buffer, if the processor is busy but the user keeps typing, if they enqueue enough times to force an overwrite of the current read index, the data will be lost forever (due to a busy processor).

I figure the example is sort of unlikely (since the buffer would either be large enough or the processor would be fast enough to avoid this), but wouldn't it make more sense to move unread data that's being overwritten to some other array? Or have multiple levels to a circular buffer?

playertwo
Автор

Isn't it's better to use a simple array or arrayList?

simon-r
Автор

thanks for the explanation, very helpful

tnczm
Автор

Why is 8 overwritten at enqueue(17)? It has not been read yet and will now be overwritten adn "lost"?

karenhompland
Автор

The sun is a circular buffer...i see it buffer everyday

skisgy
join shbcf.ru