Let’s try writing the data structure to support the animation as shown below. Basically you need to have multiple views be able to move back and forth. I went with circular linked list since, it maintains a pointer to the next and previous nodes. I wrote the data structure using Generics, this way we are