Tag: Algorithms
Edit Distance program in Javascript
We have 2 strings and we can perform below operations on st1 to make it same as str2. Insert Remove Replace Input: str1 = “cat”, str2 = “cut”Output: 1We can […]
Insertion Sort in Javascript
In last post we have posted about Bubble Sort algorithm in javascript. In this post we will write javascript program on Insertion sort. In Insertion Sort to sort an array […]
Bubble Sort Algorithm in Javascript
Bubble sort is a simple algorithm to sort a unsorted array. We will swap the the elements with the adjacent element. Please find the implementation below. References: https://www.geeksforgeeks.org/bubble-sort/ Also Please […]
Binary Search Program in Javascript
Binary Search is a technique to search a element in an array with efficient time complexity (Ologn) In binary search we divide array into halves and check if middle value […]
Minimum number of jumps to reach end of array in Javascript
Write a function to return the minimum number of jumps to reach the end of the array (starting from the first element). If an element is 0, they cannot move […]
Sort an array according to the order defined by another array in Javascript
Given two arrays A1[] and A2[], sort A1 in such a way that the relative order among the elements will be same as those are in A2. For the elements not […]
Longest Increasing Subsequence in Javascript
The Longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence of a given sequence such that all elements of the subsequence are sorted in increasing […]
Minimum number of coins program in Javascript
Input: coins[] = {25, 10, 5}, V = 30 Output: Minimum 2 coins required We can use one coin of 25 cents and one of 5 cents This program can […]
Program For Merge Sort in Javascript
Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. The merge() function is used […]