Let us work together to uncover the mystery of algorithm

Foreword

In fact, I always wanted to write an article Secret algorithm, because, as far as I can see, most of the writing algorithm software engineers, in fact, is an ordinary programmer, not superior.

But I did not know where to start, let's try a little scrawl today.

Tall's bluffing

Algorithms for bluffing thing than a formula.

And most bluffing formula touched to the Σ; symbol called sigma, as shown below:

for example:

A company meeting to discuss the project functions to achieve, the participants are: a project manager, three members of group A, group B three members and an algorithm engineer.

Then, discussing, discussing, we encountered a controversial feature.

A group of members felt that this function should loop to process, Group B members felt should use recursion to handle, parties to the dispute no less.

At this point, the project manager for shelving disputes and seeking common development. . . Then, the algorithm engineers to express their views.

Algorithm Engineer went to the blackboard brush brush wrote a formula on the map. . . Then start the show. . . Uh, yes explain.

"We have this feature, I think the use of this formula to achieve the best, this is multiplied by Ki Mi, then we seek it and, barabara ..."

Then, A group B group members to have kept, because they can not read, did not understand. Because of the rigorous nature of programmers, so once you do not understand something, they usually are not heard.

Then, in this little room, the image of algorithm engineers to instantly tall again.

"Silence means that you agree, that this feature so deal with it," the project manager said.

Finally, the end of the meeting, because nobody can understand this formula, therefore, A Team Leader and Group B leader in private to discuss a solution to the problem disposed of. . .

----------------------------------------------------------------------------------------------------

In fact, this formula is very simple, that is M = K1 * M1 + K2 * M2 + K3 * M3 + ... + Kn * Mn.

what? can not read it?

So that the total can read it.

int totalM = 0;
int n = 10;
List<int> K = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
List<int> M = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
for (int i = 0; i < n - 1; i++)
{
    totalM += K[i] * M[i];
}

Do you have any clever discovery?

[Σsigma] is for circulation there.

The following Σ i = 0, n-1 above for loop conditions there; Count K and M is equal to two arrays of n there.

In the example above, the proposed solution algorithm is a loop process engineer there. . .

If the algorithm talk engineer formula say: "set length K and M are equal, we look at the cycle, the calculation of K [I] and M [I] of the product, and cumulative sum bit."

Are not we all understood.

Of course, if he really say this, it is not up on tall. . .

In fact, we were writing the algorithm every day

Think of nausea even complex business logic we wrote, combining at the example above.

Then, you will find that you are actually writing the algorithm every day. . .

You just do not know how to put what you wrote, using the formula to express it. . .

----------------------------------------------------------------------------------------------------

Indeed, often write algorithms friend, indeed, very often can give a very good logic problems.

However, this is not on the ability to engineer the algorithm superior, but their long-term application of algorithms for computational problems, relatively more sensitive, so handle them more concise and efficient.

In fact, software engineer, too, experienced software engineers to write code logic clearer, more concise code is open source framework will be used more, it does not mean anything, because this is just the level of ability to work it.

Trying to write a formula

Write algorithm formula is very simple to use Word you can achieve it.

Writing a formula steps to open Word- insert - formula, and then select the template in which formulas, click, you can insert a formula templates.

As shown above, Word serve very much formula templates. PS: There is no discovery, the Pythagorean theorem is actually an algorithm.

After you insert a formula template, the top panel of Word will automatically jump to the design surface.

As shown above, there are a lot of functions.

----------------------------------------------------------------------------------------------------

As a programmer, you must have written documentation of it, if you add a few formulas in the document. . .

Imagine, when you look at the documentation project manager, he saw a bunch of formulas do not understand. . . Your image in his mind is not up instantly tall on it, O (∩_∩) O haha ​​~

Of course, there are really big cattle algorithm engineer, there can not be generalized.

But we do not need self-esteem than the algorithm engineers believe that it wants to first gear.

----------------------------------------------------------------------------------------------------

Note: This article is original, any form of reprint please contact the author are authorized and indicate the source!
If you think this article is not bad, please click on the below [ Recommended] , thank you very much!

https://www.cnblogs.com/kiba/p/11719727.html

 

 

Guess you like

Origin www.cnblogs.com/kiba/p/11719727.html