saragarcia6123
saragarcia6123

Reputation: 48

Ideal data structure for undo/redo but with max capacity

The obvious answer would be a stack but there is just one thing that I want to implement:

That is to only store, say, the 100 most recent edits.

This means that any point past 100 every time a new change is made the oldest edit is deleted.

I thought this would resemble dequeueing from the bottom of the stack but feel like mixing the two is a bit messy...

Any suggestions on what would be more ideal?

Edit: I just found out about the Circular Buffer data structure and realised that what I am trying to implement is most likely FIFO so currently a CB is my best bet

Upvotes: 0

Views: 342

Answers (0)

Related Questions