The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
Ok…enough of pedagogy !!! Lets make it simple now using a use case.
Strategy Design Pattern leverages these 3 design principles heavily:
Lets say we are developing a Calculator which performs sorting and searching. There are various algorithms using which sorting and searching can be performed. …
JPEG stands for “Joint Photographic Expert Group” and it is a lossy data compression algorithm used to compress digital images. It is good at compressing natural photographs but falls short while compressing vector artworks. In this article we’ll see technical details on how this famous encoding algorithm works.
Why should we compress images? — The simple answer is “to save the space”. Consider an example of 3000X4000 pixel image in RGB color space. If each channel of RGB is 8-bit, the size of this image would be 36MB !
In last few years Python has been one of the most favorite programming language of many developers because of its amazing capabilities which lets us perform multitude of developments including:
It has abundant set of libraries which make development very very easy.
The bitter truth- But there is a major problem with Python which can be cause of death of this popular language. This may not happen in short-term (in a year or two), but its inevitable to happen within a decade from now.
Python is slow ! There are…
By definition, each and every element in a set is unique and there are no duplicate elements in it.
But have you ever wondered how JAVA APIs achieve this internally? To know it all, please read on…
When you pass duplicate element in the add() method of the Set object ,it will return false and does not add it to the HashSet since the element is already present.
Lets see how this add() method is implemented internally in Java?
If we open the HashSet implementation of…