## Prime

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

## 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

## Design: Image Hosting Application

Original Article Link Below are few key takeaway from the article above. For details refer to the original article. It makes sense to split out reads and writes of images into their own services - The advantage of this approach is that we are able to solve problems independently of one another—we don't have to… Continue reading Design: Image Hosting Application

## Latency Numbers Every Programmer Should Know

Introduction to Architecting Systems for Scale A critical piece of any distributed system is a load balancer. Load balancers are a principal part of any architecture, as their role is to distribute load across a set of nodes responsible for servicing requests. This allows multiple nodes to transparently service the same function in a system.… Continue reading Load Balancers

## Basics for System Scaling

Common Techniques Server Farm (real time access) If there is a large number of independent (potentially concurrent) request, then you can use a server farm which is basically a set of identically configured machine, frontend by a load balancer. The application itself need to be stateless so the request can be dispatched purely based on… Continue reading Basics for System Scaling

## CAP Theorem

A plain english introduction to CAP Theorem The CAP Theorem (henceforth 'CAP') says that it is impossible to build an implementation of read-write storage in an asynchronous network that satisfies all of the following three properties: Availability - will a request made to the data store always eventually complete? Consistency - will all executions of… Continue reading CAP Theorem

## Searching Problem List

Interpolation Search. Youtube. GFS.  The search works well for uniformly distributed numbers.  Formula Calculation - So the formula to estimate the position = pos = lo + [ (x-arr[lo])*(hi-lo) / (arr[hi]-arr[Lo]) ] arr[] ==> Array where elements need to be searched x ==> Element to be searched lo ==> Starting index in arr[] hi ==>… Continue reading Searching Problem List

## Array Set 3

Array Set 1  Array Set 2 Given an array of of size n and a number k, find all elements that appear more than n/k times. GFG. Code. Brief Algo: We basically maintain an array which has keeps track of element and it's frequency. But we don't maintain the count of all the element. We… Continue reading Array Set 3