Algorithms

## Find the middle of a given linked list

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?

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…

## How to Generate Prime Number Using JavaScript

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…

## How To Implement LRU Cache In JavaScript In 28 Lines Or Less

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…

## How to implement PhoneBook using tries data structure in typescript

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’…

## Write a function to delete a Linked List in C#

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…

## QuickSort implementation in TypeScript using recursion

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 fun…

## Finding All Words Inside A String Using A Trie | Real world example

In this article, I am going to discuss how to implement autocomplete using jquery and Trie data structure. Before going into code implementations, let’s understand what a trie is. What is a trie A trie, also called digital…