Implementation of LRU Cache Using Python What is a Cache? A cache is a hardware or software component that stores data so that future requests for that data can be served faster. The data stored in a cache might be the result of an earlier computation or a copy of data stored elsewhere. What Is An LRU Cache? So an LRU Cache is storage of items so that future access to those items can be serviced quickly and an LRU policy is used for cache eviction. The Constraints/Operations Lookup of cache items must be O(1) Addition to the cache must be O(1) Our Structures Doubly Linked List: This will hold the items that our cache has. We will have n items in the cache. This structure satisfies the constraint for fast addition since any doubly linked list item can be added or removed in O(1) time with proper references. Hashtable: The hashtable will give us fast access to any item in the doubly linked list items to avoid O(n) search for items and the LRU entry (which will alw
Python 4.0.0 As of July 28, 2021, Python version 2.9.6 has been released. One of the biggest tasks for most of the python community was when the last major shift happened i.e. Python 2 Projects were to be migrated to Python 3. Most of us found the whole new change in the python package's way of writing, and at most of the places, the handling of Unicode was a mess. So the big picture stands when will Python Version 4.0 be released? Will the next major version of python bring any major changes in old codes? And at last, will it create a mess again for migrations of our Old Projects? Well as per the latest guidelines on Python.org unlike Python 2.9 and then Python3 the shift to Python 4 won't be so early. As per Guido van Rossum, creator of the popular programming language, Python 4 is still far away. Python-Dev Community would be working on the Python 3.11.0a0 version of Python which is expected to be released by the end of the year 2021. So no all the major fuss about Python