Skip to main content

Posts

Featured Posts

Caching Algorithms (LRU Cache).

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
Recent posts

Python 4.0.0 Will it be released ??

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

The Harsh Truth About Software Industry

The Harsh Truth about Software Industry. For all of you folks out there  who are about to join or dreaming of joining the software industry need to check the following points before you go on becoming a hedgehog of this industry. So let’s go from negative points of this so-called software industry. Software Industry is No Normal Job. As in the case of other industries the knowledge that you have learnt once or might be a couple of years ago would be sufficient here it won't. Every Software in the market comes with a newer version every year. The technology industry is booming with competition and  competition brings the ever changing world of software. Hence you need to study every moment of your technology you are working on. Flexible Timings are a Myth.    If a firm says you have flexible timings believe me that just means if the company needs you, you’ll be working weekends, sure the perks will be there for some firms. If you think flexible timings just means that you can go i

Python: Creational Design Patterns.

Creational Design Patterns. Creational Design Patterns are one of the simplest sets of Design Patterns. Advantages Object creation can be independent of class implementation. Adding support to a new type of object is very easy The logic of object creation is hidden . Creational Design Patterns Include 1) Singleton Design Pattern This Pattern states that at a given time there should be only one `instance` of any given object. Thus reusing the object over and over again. Singleton Object creation has only 2 sets of rules to be followed. 1) Object Must have only Single Instance Created. 2) There should be global access to the object created. In Python Singleton is easiest to create for any given class. Since the `__new__` is always a class method in python (until version 3.8). You can always modify this method to make your object as a Singleton Object. Advantages Only a single instance is created hence low memory usage. Faster Execution Since the Class is Not instantiated multiple times.