do not shift the array as this is very consuming
just change the input pointer and the output.
so one shift (pointer) is enoough iinstead of the whole array
suppose you have a list of 100 items.
when you have to shift them like you are used to you need 100 instructions to get one shift done.
i have a list and a input pointer and an outputpointer
the input starts at zero (as most arrays start at 0
whenever the line is advanced the inputpointer is added one and the list is written if a bottle is present or not.
the output pointer start at 90 for example. same here the outputpointer is added when the line is advanced. then check if list is true or not.
a check for pointers overflow is needed. if any pointer is >=100 the pointer is reset to 0 again
use a few coins on a strip of paper and two pens as pointers.and simulate the action.
Thanks for the explanation, the concept is good, but, will that increase the overhead, at least upon shifting occur.
Maybe is alright, due to faster processors now a days.
Regards
________