Showing posts from December, 2022
This book is intended for those who do not have the time to read a lengthy book or tutorial. This book is a collection of algorithms and data structures, along with the code that explains them. This book is simple to understand…
The tortoise and hare algorithm is a classic algorithm to find the median of a linked list. It is named after the fable of the tortoise and the hare, where the tortoise wins by virtue of its steady pace. The algorithm works as …
What is the two pointer algorithm? Two pointer technique is used to solve this problem in O(n) time complexity and O(1) space complexity For example lets suppose you have a sorted array and you want to find the sum of two elem…
The goal of the SOLID principles is to make our code more maintainable and extensible. While this is the ultimate goal, it’s not always the first step we take when starting a new project. The SOLID principle are guidelines for w…
When it comes to choosing between JavaScript and TypeScript, there are a few factors that should be considered. One of the biggest differences between the two is that TypeScript is a superset of JavaScript so it means that it ha…
The Linear Congruential Generator is a pseudo-random number generator. It is one of the simplest and most widely used algorithms of this type. It was developed by Donald Knuth in 1974 and it’s based on the linear congruential met…
Prime number is a natural number that has exactly two distinct natural number divisors: 1 and itself. The first 30 prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 and 53. Prime numbers are very importa…
DoublyLinkedList is a data structure that contains a head, tail and length property. Linked Lists consist of nodes, and each node has a value and a pointer to another node or null. The DoublyLinkedList is an extension of Link…
Regular expressions are a small but powerful language that can be used to find patterns in strings. These patterns can then be used to perform tasks on the strings or extract information from them. Regular expressions are commo…
State design pattern is a design pattern which helps us to change the state of an object. State design pattern can be used in cases where we have to track the state of an object and its behavior is dependent on that state. The…