You are implementing a caching mechanism. You need a data structure that removes the least recently added item when the size limit is reached. Which built-in Python data structure would you use?

  • List
  • OrderedDict
  • Queue
  • Set
An OrderedDict (Ordered Dictionary) is a built-in Python data structure that maintains the order of elements based on their insertion time. It can be used to implement a caching mechanism where the least recently added item can be removed when the size limit is reached.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *