mmnaseri / cs-review

An effort to refresh my CS background
MIT License
251 stars 72 forks source link

FixedSizeQueue should recover from extreme dequeue operation + adding… #15

Closed rfarhanian closed 6 years ago

rfarhanian commented 6 years ago

FixedSizeQueue should recover from extreme dequeue operation. When queue is enqueued and dequeued several times (till it becomes empty), the tail index will lose track of the tail. It only happens if we dequeue after it becomes empty again. Changing the if logic will fix this problem. I started changing the code after the regression test failed.