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

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…