For my final project in 6.851: Advanced Data Structures, I implemented algorithms for retroactive data structures using Python.

Retroactive data structures are data structures in which operations and queries are allowed to be made in the past, updating the data structures as if history itself had been rewritten.

For example, consider a list datastructure in which we’re allowed to insert or remove operations from the past:

>>> y = FullyRetroactive([1,2,3])
>>> y.insertAgo(appendOne, tminus=0)
>>> y.insertAgo(appendSix, tminus=0) ##This one should come last
>>> y.insertAgo(appendTen, tminus=2) ##This one should come first
>>> y.query()
[1, 2, 3, 10, 1, 6]   ## The current state of the data structure
>>> y.query(1)
[1, 2, 3, 10, 1]
>>> y.query(2)
[1, 2, 3, 10]
>>> y.query(3)
[1, 2, 3]   ## The state of the data structure way back in the past

Read more about it at GitHub.