Algorithms

It is a combination of sequence of finite step to solve any particular Problem.

Now the very Important thing here to understand is that .We are passing some finite steps

Your step can’t be infinite otherwise your code is run into infinite loop.

For Example let me try to give one  very  simple example

Suppose I want multiply two numbers.

What algorithm you write for that

If you want to multiply two number

If suppose I am say tell me the algorithm for this

You will say

 

Step one is that you will take two numbers say the number are (a.,b)

1) Take two numbers (a,b)

After that what can you do that

You will just try to multiply these two numbers and store it some in other variable

Which will try to store basically result of that

Basically you can say that now take c storing the result of a*b

2) Take c=a*b

And finally what can you do that you can simply return the value of c

3) Return c

Because that is something I am say of multiply of two numbers

So basically here you see I am having just three step are finite number which are trying the solve the problem multiply the any given  two number.

 

1) Take two numbers (a,b)

Now these number are something which enter by the users .

So this is something where we solved particular problem

In our case our example problem is multiply two numbers.

And that have the some sequence right

First of all this thing happen

Then this thing

Then finally we will get the result.

With this only

Lets we will talk about property of algorithm

What are the property of algorithm

What are the important property of algorithm we should know

So first property now I hope given property itself

You will able to get the judgement

Like what should be the very first property that we have

Very first property is that whenever you writeing any kind of algorithm

Its should be terminate after finite amount of time

Terminate after  finite amount of time.

Its not like that that you code are not terminating which should terminate after finite amount of time

Its should not be like that its running infinitely

Second important property is that whenever you writing any algorithm it should produce atlist one output

Produce atleast  one output

Its should not like that

That your code is not produce any output

It can produce more than one output as well

But whenever you writing any algorithm its should produce atleast one output for example in our example the output will be you see.

The third important  property is that what

Whats ever code you are writing

Its is independend of any programming language .

Independent of any programming language

Now this is very important write why is that so

Many learns ask that which programming language should I try to start to understand algorithms

Algorithms is something which will help you to solve the problem its kind of logic .

But how you can implement is that depending on you

Because as I am telling you this is independent of any programming language like you can go with c you can go with c ++ you can go with java you cany go with pyrhon you can go with any of yous fav programming language whateve you want .

So this is more important thing that you have to keeping in your mind that whenever we are talking about algorithm its is not dependent of any kind of programming language .

 And last important point is that

Whenever you writing any algorithm the code you writing should be .

The algorithm or code that you are writing is unambiguous or in other worlds I would say its should be derterministic) what is tha mean is simple meaning is that

Suppose today I am running any logic that we have writtin algorithm that we have wrtting

For example let me take the same example

Of multiply the two numbers

Now today user passing the value

A=5

B=6

And you code return the answer is 5*6 = 30 its storing in c

And it is giving me the answer is something jst eqal to 30 write

Now in this example

Suppose the same algorithm whatever you writtin here

I have use the same code after may be 8 years

So what happen when I am typing the same input

5*6

It should prodce the same same output

It means that whaever inputer you passing today

Go getting the some output and if you use this after several years searval days also

Whw=en you are using this code its should be produce the same output

Its not like that today producing 10

But after some time it will producing 30 20 12 after some time write

Ever inpute output remain same

So that the important property of an algorithm

So I think in todays session

What we have covered a

First of all we see what is mean by algorithm

Because the world algorithm you heart lot of time

So it should very much clear to you

What is the meaning of an algorithm

So it’s a simple combination of sequence of finite steps

Then we have took the example of multiplication

And then we have seen what is the property of algorithm.

I hope this part preety much clear everyone

If you still have any short of doubt do let me know with this .

 

To view or add a comment, sign in

More articles by Gaurav Tripathi

  • How to Generate an Action Figure Image Using Freepik – Step-by-Step Guide

    Have you ever imagined turning a simple rug image into a premium collectible action figure inside a blister pack?…

  • What is an Algorithm?

    Understanding Algorithms: A Beginner's Guide Algorithms are the backbone of computer science and problem-solving in…

  • What is HTML?

    HTML, or HyperText Markup Language, is the foundational language used to create and design webpages. It is a standard…

  • Cloud Security Blind Spots

    In the rapidly evolving landscape of cloud computing, organizations are increasingly migrating their operations to the…

  • Top Cloud Security Concerns

    The adoption of cloud computing continues to accelerate as organizations seek to leverage its scalability, flexibility,…

Insights from the community

Others also viewed

Explore topics