0

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

nix_s
  • 38
  • 5
  • 1
    A linear data structure that allows pushing and popping from both ends is usually called a "deque", short for "double-ended queue". There is often an implementation of deque in a programming language's standard library. A circular linked list is just a possible particular way to implement a deque. – Stef Jan 03 '22 at 10:40
  • See for instance [python's collections.deque](https://docs.python.org/3/library/collections.html#collections.deque) and [C++'s std::deque](https://en.cppreference.com/w/cpp/container/deque) – Stef Jan 03 '22 at 10:43

0 Answers0