Close

Prime number algorithms

Let us begin with the definition of a Prime number.A number which has only 1, and itself as factors is called a Prime number. The simplest problem that one can try is to check if a given number is a prime or not.If we find that the factors of the given number are just 1,…

What is a proxy server

The dictionary meaning of the word proxy is the following. the authority to represent someone else, especially in voting. In client server architecture of computing, a proxy server is a middleman between the client and the server. When we access the internet using clients such as a browser, or mobile etc, they connect to the…

How to use Bitsets

In programming, we often need to represent a list of integers in some range using a compact structure to reduce memory consumption. For example, if your program needs to find missing numbers from a huge file which can’t fit in memory, and all the numbers are in range of say [1, (2^64)-1] We need to…

Comparing different types in python

If someone already have experience with languages like C/C++, Java, C# comparison between two variables of different types results in a compile error. But in Python this will simply evaluate to false. So beware when comparing a string and int containg same values. when we print, they look the same. I actually faced this issue…

Edit distance 1

Given two strings, how do we check if their edit distance is 1?Edit distance is defined as the number of characters that needs to be modified, inserted or deleted from one string to transform into the other string.For example let us consider two strings “java”, “lava” they both differ by just one character. we can…