# Learn Python With Dhawal - 14 - Learning about Pseudocode and Algorithms.

Before we dive further into the programming challenges and solve them one by one. I want to pause here a little and explain the concept of Pseudocode and Algorithms. For any programmer, it is very important to know about algorithms and its kind of twin brother pseudocode.

What is an Algorithm?

Before we begin with other things, we need to know about what an algorithm or 'algo' in a slang/jargon language actually means here. Before we begin to actually code, we need to mentally prepare a plan or a blueprint on how we are going to execute a particular program. An Algorithm is basically a blueprint for the actual program that you are going to write.

An Algorithm is made of very simple statements like IF, DO, THIS, JUMP, BREAK. You can write a more complex algorithm but then it would be of a pseudocode than an algorithm. Coming back to the topic, Algorithm consists of a very basic step by step instructions that we need to perform to execute a particular function or a program.

Algorithm is a set of step by step logical instructions to the machine to get the work done.

Algorithm is said to be a blueprint of the program as

A Program is a set of step by step logical instructions to the machine to get the work done.

But the only difference here is that algorithm is most basic and doesn't have concepts of loops, unless you want to add it in there which makes it close to the pseudocode.  Algorithm also doesn't have any complex elements like data structures or 'Arrays' to be specific. Your pseudocode might have arrays and  data structures.

You can write code in any language studying its algorithm. Hence it becomes quite handy when there are multiple languages, platforms, and people working on a same set of project.

How to Write an Algorithm?

Consider writing an algorithm for a program where there are two numbers and if the number one is greater than another, lesser one is subtracted from the greater one and the result is shown.

Rules for Writing an Algorithm.

1. Always write simple steps, basically one computation or instruction at a time.
2. Use functions like IF, DO, THEN, JUMP, BREAK, GO, STOP, START, etc...
3. Always begin an algorithm with START and end with STOP.
4. You can write algorithm in lowercase but for the sake of simplicity, here we are using uppercase for the main actions like START, STOP, DO THIS, PRINT, etc..
5. No need to specify the data types of any of the variables.
6. Always number the steps of the algorithm
So, if you're ready, let's begin.

Write an Algorithm to find smallest of the two numbers and then subtract smaller one from the larger one and show the result.

```
START
A=10
B= 5
C=0
IF A>B THEN GO TO : 7
IF A<B THEN GO TO : 9
IF A=B THEN GO TO : 12
C=A-B
GO TO: 14
C=B-A
GO TO: 14
PRINT "No difference"
GO TO 15
PRINT C
STOP

```
Here are you can see, we simply wrote what we had to do, if you have to write it in C or JAVA or Python the same code might have different number of lines and maybe different way of execution as well. This was the very bare bones and basic example of an algorithm.

Remember we had previously worked upon a Calculator program? Try making an algorithm for the same program. You can email it to me or just comment the google docs link in the comment incase you want me to check and comment on it.

What is pseudocode?

Pseudocode is basically a form of advance algorithm where we can use complex things like functions, parameters, loops, if else etc, but there won't be any syntax in it. Since it is syntax free but looks almost like a code, it can be adapted into any coding language way more easily than the algorithm. It is easy to understand and resembles the actual coding formats very much.

Python at times almost looks like Pseudocode here and there, as there's almost no syntax and its very minimal. That is why it is very important to understand the importance of pseudocode and how it is different from python. In that manner you will understand how python is very easy to write compared to other languages.

Here's a simple example of a pseudocode for the same algorithm we wrote above followed by It's code in JAVA and It's Code in Python

Pseudocode

```
a=10
b=5
if ( a>b) then
c=a-b
print c
elseif (a<b) then
c=b-a
print c
else
print "No difference"

```

JAVA Code

```
{

public static void main(String args[])
{
a=10,b=5;

if (a>b)
{
c=a-b;
System.out.println(c);
}
elseif(a<b)
{
c=b-a;
System.out.println(c);
}
else
{
System.out.println("No difference");
}
}// end of main
}//end of class

```

Python Code

```
a=10,b=5

if(a>b):
c=a-b
print (c)
elif(b>a):
c=b-a
print (c)
else:
print ("No difference")

```
As you can observe from the above examples, the length of the pseudocode and python is same for this example, at times in complex ones it might go even less than the pseudocode itself as you don't use data structures which are complex like lists and queues but you can implement the simpler ones like arrays.

Well the actual scope and limit of pseudocode might differ from where you are learning since some believe it should be kept simple as it can be easily adapted into other languages as well while some feel complexities should be used if you are going to do it only for a specific language.

You can say that pseudocode is a lazy programmer's code.

With this I hope the concepts about both algorithms and pseudocode are clear. We always write the algorithm first, followed by pseudocode if needed and then we start working on the actual program. So in future if you get a problem which you aren't able to solve directly, then instead of jumping into coding directly, you can play around with algorithms and then move up the ladder and make a complex code out of it.

~*~*~*~

This series is totally authored by me (Dhawal Joshi). Any similarities found on the text, or codes or anything is purely accidental. All the sources of reference will be mentioned, linked and will be given the proper credits. If I miss anything or there's anything wrong, feel free to comment or send me an email and I'll try to edit it out. I am not a Python expert, I am sharing whatever I have learnt on my own and with a few sources around to refer from which will be mentioned. Also feel free to share this series with others so most can benefit out of it.

~*~*~*~

Do comment and share your thoughts about it! I'd love to know what do you think. Also, I'd keep updating it quite often so do follow the Website to get all the updates by clicking here.

Share :

# Instagram Growth Hacks - How to Grow your Instagram Account?

For the past few months I have been experimenting with my Instagram. I had been researching about all the myths that are roaming around regarding so called 'hacks' to get your Instagram account growing.

For the most users it might not be a matter of concern but for a wanna be influencer or someone who is into marketing business already or any personality who needs to gain attention, there are myriad of tips and ticks on how to get viral and how to grow and get more followers, likes, comments, etc.

Here I did quite a few range of different experiments based on whatever knowledge I could gain through the Internet and open forums. I spoke to owners of a few very famous pages and accounts and discussed about their content strategies. I also keenly observed accounts only a few months old but slowly gained followers without any break. Yes, I obviously eliminated overnight or accounts that have paid for the followers as it was quite obvious by their engagement range and types of comments and the accounts that followed them.

Summarising all the experiments I performed, I have made up a list of conclusions which can be used as hacks to actually make your account grow over the platform. All of this is plainly my observation and It might or might not work out for you.

Most of you wonder how does growth is affected by these? The answer is I realised that Instagram hides the stories and posts from the users and that is done very smartly. It won't show you the stories or posts at all. You'd think the person has gone missing almost. Rarely you'd see a story or post from that person.

There's also Instagram Jail which you'd be put into if you spam too much, by liking too much, commenting too much or even following too much.

Think of Instagram as a Game and Yourself as a Player. The algorithm gives a plus and a minus point for almost every action, the amount of points depends on the type of account you use, things you like, things you do on the platform, etc...

I will use the word App for Instagram Algorithm as an alias below.

Things You Need To Avoid Doing ( Things that will give you minus points in profile ranking ):

1. This actually came via a friend of mine and then it inspired me to conduct this experiment. If you block someone on the app, you get minus points. It shows directly on your reduced engagement rates.
2. Unfollowing someone gives you negative points as well
3. Getting Blocked also gets negative points
4. More you comment, negative points. I know this is quite opposite of the thing I would say in the next section but small, simple emoji comments or overly commenting on every alternate post, gives you a minus point.
5. More you like, lower you rank. Liking something is a good option but when you are liking too much, it can reduce your reach as you slowly start fitting into a consumer range rather than a creator range.
6. Scrolling a lot on the feed can also let you give negative points.
7. Not posting also will give you less of a engagement reach.
8. Not following back also gives you a negative point. As it is a social media app and if someone isn't following back or commenting or liking their friends posts, its going to cut your reach and might put you into business account zone where you have to pay to play.
9. Converting back and forth to and fro from business account to personal account and similarly for private account to public account.
10. Going private from business limits the reach at the same time going public from private does the same.
11. Using hashtags can be one of the factors that might be limiting your growth drastically. While most tips and tricks say use hashtags to get growing, on the contrary, usage of hashtags can limit you to a particular type of audience unless you constantly keep changing hashtags or use some app to apply only spammy and trendy tags all the time.
12. Sending a lot of follow requests and following a lot of people might also do the same. Follow unfollow haven't had much effect though in my observations.
13. Don't be desperate, that's most important.

Things you should try ( Things that will give you a plus point in profile ranking ):

1. Avoid Using Hashtags as far as possible. I'd say don't use them at all. That way App won't be able to classify you in one particular niche and would show you to most kinds of audiences.
2. Avoid following back everyone. At the same time make meaningful connections.
3. Don't send too many message requests. Chat only with selective possibly.
4. Post more of selfies, or pictures where your face can be easily tracked out by app. Accounts in which there are pictures with a lot of selfies or pictures where algorithm can trace faces gain more traction and are often recommended in search lists.
5. Reply to only 25% of comments. Ensure to make a sentence in comment and not just emoji or one word.
6. Keep a Private/Personal/Business Account only. I mean to say, keep only one type of account and avoid switching.
7. Post good content and no need to time the posts. More you make it predictable more the app will push your engagement down.
8. Don't scroll through the feed more than half hr per day. This has to be tested more yet but mostly if app puts you in the customer zone, it would be hard to come out from customer zone to creator zone.
9. If possible don't ever pay to play. Once you pay to get more reach, app understands your need to get more reach and it will exploit that need every time with a little change to extract more and more money out of you.
There are a few funny things I realised that when I started following more people, the lesser content I was able to see from them. Mostly spammy content plagued my feeds all the time. Tags here and there and mostly things I would classify as spam. But as soon as I reduced the amount of people followed after being annoyed to death by spam. I was actually able to see improvement in the feed and story contents. I was seeing stories from people who were kinda mia already. It was quite weird but this is what I noted as I purposely followed and unfollowed to establish this as a fact.

I wonder what sketchy mysteries does this app hides further.

Do comment and share your thoughts about it! I'd love to know what do you think. Also, I'd keep updating it quite often so do follow the Website to get all the updates by clicking here.