Posts

Showing posts with the label algorithms 101

Basic algorithms 101 : Checking for email address validity (without regular expressions)

Image
Hello! Welcome back to “Basic algorithms 101”. Last time we discussed about a coin toss algorithm. It was a fairly easy one. This time we are taking up a slightly more complicated one. It is, checking for the validity of an email address. Basically it’s an algorithm to check if the given email address is a valid one or not. If you are a pro coder, I suggest you don’t read this because we are not going to using regular expressions but taking a simpler but slightly longer route. If you are a beginner and not comfortable with regular expressions, do not worry, there are other ways too. If you are among the people who have no idea what regular expressions are, I strongly recommend you look it up.

Basic algorithms 101 : Coin toss (unbiased and biased)

Image
Welcome to the first post of the new series “simple algorithms”. In this series we will be dealing with simple to understand programming algorithms. If you are a beginner at programming or aspiring to be a programmer, this series is meant for you.  For convenience we will be taking python as an example for the code. In this first post, will be dealing with a very simple algorithm which is “The Coin Toss algorithm”. In case you don’t know a coin has two sides, a head and a tail. When you flip it, the outcome is either a head or a tail.  As you can see, there are only two cases. So that makes it very easy.  Some people might want to know the algorithm for a biased coin. So we will be looking at that too. The biased one is slightly trickier than the unbiased one. First, let’s look at the unbiased and then get to the biased coin.  So without any further ado, let’s just get right into it.