All right, how do we do this in praxis?
Or if we actually want to do this for a given algorithm, how do we do that?
Well, there's this thing called induction that I'm sure you've heard about by now.
And we're saying, all right, we have a few simple cases for, well, yeah, for something
like the typical programming language, though not any given one, a particular one.
So yeah, we can go over all the most popular cases of what might happen in our program,
and then we can derive the complexity of the algorithm that the program does from that.
So for example, if you're talking about a constant, it's fairly easy, blah, blah, blah,
blah, blah, mathematics, the time of alpha is an or 1.
Because obviously, if you have a constant, there's nothing much to do.
Variable, well, if you're wondering what the complexity of a variable is, it's whatever
the variable refers to.
Also makes sense?
Application, if we have our algorithm is some phi applied to some psi, then, and phi is
an O of F and psi is an O of G, then the whole thing, alpha, is an O of F after G.
Also makes sense, right?
Come on, you can do this.
Very good, keep that up.
If something's not clear, I want feedback on that.
And this shit can be complicated.
So assignment, blah, blah, blah, blah.
If our alpha is an assignment of phi to a variable V, and phi is in S, then blah, blah,
blah, mathematics, it doesn't really come up.
And we already spent some time in the last section, so I don't want to spend too much
time on this one.
So yeah, then the time of alpha in its entirety is also in S. If you assign something to a
variable, the whole complexity is the complexity of the something, not of the variable.
So if we have alpha is first a phi and then a psi, and phi is in P, and psi is in Q,
it should be not F. Then the time of, ah, let's cut off again.
Can I move this over in some sense?
This could be.
This time it's actually important.
Blah, blah, blah, blah.
If you have phi and psi, then, and phi is in P, and psi is in F, then alpha is in max
of P and F, or should say Q over here.
Make sense?
If you do two things after each other, first the one and then the other, and the one takes
way, way, way, way, way longer than the other, then the complexity of the whole thing is
the complexity of the one, not the other.
Branching.
If we have your alpha is if gamma, then phi else psi, phi, where gamma is in C, phi is
in P, and T is in psi, and psi is in Q, it should say, then again it's the maximum.
If we have an if then else, that means whatever your three components are, the one with the
highest complexity gives you the complexity of the whole thing, which can be the Boolean
over here.
If you're doing programming, you could have an if then else branching where the bodies
of the individual cases are fairly simple, just this constant or that constant, but the
gamma that you're computing on the beginning is like, if something, something, something
is true, then this else something or the other.
That can be.
Presenters
Jonas Betzendahl
Zugänglich über
Offener Zugang
Dauer
00:11:55 Min
Aufnahmedatum
2020-10-26
Hochgeladen am
2020-10-26 10:56:58
Sprache
en-US
How to determine time/space complexity and why we need it. Also, NP vs. PSPACE is discussed.