The Tortoise and Hare Algorithm is a popular algorithm used to find the median of a linked list. It derives its name from the fable of the tortoise and the hare, where the tortoise wins due to its steady pace. This algorithm prov…
The two-pointer technique is a powerful approach to solving certain problems with optimal time and space complexity. One common application is finding pairs in a sorted array that sum up to a given target. In this example, we’ll…
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…
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…
Trie is a node-based data structure. It is used to implement word lookups. It is better than the use of HashTable because it can store efficiently sorted data and don’t have to use a sorting algorithm while retrieving data. We’…
In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collecti…
In this blog post, we’ll explore the MinStack data structure in JavaScript, covering its design, implementation, and how it works under the hood. We’ll also include visualizations to help you better understand how this data str…
This post will discuss how to implement the QuickSort algorithm in typescript/javascript. Quicksort is the fastest algorithm. Quicksort works on the divide and conquer strategy. All languages in the world provide sorting func…