So just because there are five iterations, so any of five of them can be

the first one, any of the remaining four of them can be the second one, and so on.

So this is 5 by 4 by 3 by 2 by 1, which is equal to 120.

This is already not so easy to do this by hand.

I mean, to go through all possible such orderings.

Well, this is not easy, but we can teach a computer to do this, right?

So we can implement an algorithm that goes through all possible orderings.

However, in general, this algorithm will perform roughly n factorial steps,

where n is the number of arithmetic operations, for exactly the same reason.

If you have n arithmetic operations, then any of them can be the first one.

Any of the remaining n minus 1 operations can be the second one, and so on.

So this is n times n minus 1, times n minus 2, and so on.

This is equal n factorial, and n factorial is an extremely fastly growing function.

For example, 20 factorial already equals roughly 2 times 10 to the 18.

This means that if you implement such an algorithm, it will not be able to

compute the maximum value of an expression consisting of just 20 digits

in a reasonable time, even in one year, not to say about one second.

Which means, as usual, that we need another algorithm,

as you might well have guessed.

We will use dynamic programming to find, to design a more efficient algorithm.

In the meantime, you might want to check your intuition by trying

a few possible orderings to perform in this small expression,

and by using our in video quiz.