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 …
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…
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…
Lexer and Parser are two important components of compiler. Lexer is responsible for tokenizing the source code, and parser will read the tokens to build an AST(Abstract Syntax Tree). To implement Lexer and Parser in JavaScript,…
LRU stands for Least Recently Used. It is a cache algorithm that is used to determine which elements should be discarded from memory when the cache is full. The most basic LRU algorithm would simply check the last time a given v…
In a priority queue, each element has an associated priority. Elements with higher priorities are served before elements with lower priorities. In a priority queue, the element with the highest priority is served first. In Java…
This blog post I will show you how to implement did you mean by in JavaScript. This algorithm can be easily translated to any language like C# ,Java or python. The implementation of Did You Mean By can be done by using edit di…