00:01
We're figuring out which characteristics these algorithms have.
00:07
And so for this first algorithm, it's a doubling algorithm.
00:10
And it takes an input here, a positive integer n.
00:16
So it has input.
00:19
And while that n is greater than zero, which is given because it requires a positive integer, it is going to reestablish n as being equal to two times that number.
00:31
And so imagine we pick that number.
00:32
Say 5 positive integer.
00:36
Well, we get to this step here, and 5 is greater than 0, so that checks out.
00:40
And then we move here.
00:41
And we're going to be setting n -then equal to 10, right? but our new n -10 is also greater than 0.
00:48
So we're going to head back up here.
00:52
See that it's greater than 0.
00:53
Head back down to the second step, and now we're going to get 20.
00:58
Okay, then 20 is still larger than n, so we're going to end up doubling that again.
01:02
We're going to get 40, and this is just going to keep going on and on and on and on.
01:07
Okay, so despite it having this input and this perfectly defined steps, right? so it does have this to the finiteness.
01:24
It is lacking.
01:26
It's lacking an output.
01:28
We never get to see what n ends up being.
01:32
And it's also lacking this correctness, right? because ideally you would just double your integer and then be done, right? so you might just say cross this off, say n is equal to 2n, and then return n would give you a more correct solution to a doubling algorithm.
02:00
And due to the fact that it's incorrect, it loses its effectiveness...