Sieve of Eratosthenes - Given a number n, print all primes smaller than or equal to n. It is also given that n is a small number. GFG Least prime factor of numbers till n - Given a number n, print least prime factors of all numbers from 1 to n. GFG Algo: Use Sieve of… Continue reading Prime

# Category: Miscellaneous

## Sorting – Set 2

Sorting Set 1 Sorting Set 3 Given an array of n integers. The task is to check whether an arithmetic progression can be formed using all the given elements. If possible print “Yes”, else print “No”. GFG Algo: We don't really need to know the arithmetic difference. We can just take the diff of first two and… Continue reading Sorting – Set 2

## Sorting – Set 1

Sorting Set 2 Sorting Set 3 Given an array of n distinct elements. Check whether the given array is a k sorted array or not. A k sorted array is an array where each element is at most k distance away from its target position in the sorted array. GFG. Algo: Copy the array into another… Continue reading Sorting – Set 1

## Greedy Algo

Minimum Number of Platforms Required for a Railway/Bus Station.Given arrival and departure times of all trains that reach a railway station, find the minimum number of platforms required for the railway station so that no train waits. We are given two arrays which represent arrival and departure times of trains that stop GFS. Also: We… Continue reading Greedy Algo

## Pending

find median of sorted array Print all combinations of points that can compose a given number Print all possible sums of consecutive numbers with sum N Given an array of n integers. Find the maximum value of arr[i] mod arr[j] where arr[i] >= arr[j] and 1 <= i, j <= n Find a Fixed… Continue reading Pending

## HyperLogLOg

## Sliding window problem

List of question [Skip] Sliding Window Maximum (Maximum of all subarrays of size k) - Given an array and an integer k, find the maximum for each and every contiguous subarray of size k. Youtube. We are skipping this question as it the dequeue implementation is tough and not worth the time. It will be difficult… Continue reading Sliding window problem

## Priority Queue

http://www.geeksforgeeks.org/applications-priority-queue/ Find median in stream of numbers - MedianFinder.java

## Breadth First Search

Minimum time required to rot all oranges Breadth First Traversal or BFS for a Graph Minimum throw required to win the snake and ladder game Shortest path in a maze Flood Fill - Wiki Given a binary matrix where 0 represents water and 1 represents land, count the number of islands in it. A island… Continue reading Breadth First Search

## Basic Algorithm List

List of few algorithm that come handy. Not that they are super important for interview or anything, but the mainly for knowledge sake. Kadane Algorithm - Largest Sum Contiguous Subarray Code Youtube The idea is simple. At each index of array we check if what's the maximum subarray till now. The max subarray can be either the… Continue reading Basic Algorithm List