Factory Method PatternStop Using new Everywhere At some point, every codebase reaches this stage if (type.equals("CAR")) { return new Car(); } else if (type.equals("BIKE")) { return new Bike(); } else if (type.equals("TRUCK")) { return new Truck(); } It works...Dec 19, 2025·3 min read
The Art of Optimization: DebouncingSuppose your application has a search bar and it calls an API every time on change event is triggered. You typed some 6 letters word in that then that makes the API call 6 times. What if you typed some 100 or say 1000 letter word then wont that make ...May 18, 2024·2 min read
Moore's Voting AlgorithmAs the name suggests "Voting Algorithm", involves a concept of voting i.e. which candidate got the maximum vote or which event occurred the maximum number of times wins the election or the selection. So in the concept of Data Structures and Algorithm...Oct 2, 2023·3 min read
Dutch National Flag AlgorithmTalking about Dutch National flag algorithm all we can think of is a problem , if and else conditions in loop and there we go the array is sorted.But we never talked about its intution , why we use and how it actually work. Lets dive into the algorit...Sep 15, 2023·3 min read