Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,210 --> 00:00:01,860
What's going on, ladies and gentlemen?
2
00:00:01,980 --> 00:00:06,570
I hope you're feeling good and that you are ready for a recursion challenge.
3
00:00:06,680 --> 00:00:11,520
And in this challenge we are going to write a function, if feeble, not your function and recursive
4
00:00:11,520 --> 00:00:18,030
one that will get some and which represent the index of an element enfeeble not you serious.
5
00:00:18,180 --> 00:00:22,620
And the function should return the associated value to these given.
6
00:00:22,740 --> 00:00:28,920
And so write the recursive function that receives this parameter or some number n and this and will
7
00:00:28,920 --> 00:00:33,660
represent the index of a given element in Fibonacci series.
8
00:00:33,780 --> 00:00:38,310
So you find, you get your index and then you find a value.
9
00:00:38,440 --> 00:00:39,460
Ian Fibonacci.
10
00:00:39,480 --> 00:00:40,070
Serious.
11
00:00:40,380 --> 00:00:41,020
And for result.
12
00:00:41,190 --> 00:00:45,000
For those of you who is not familiar with what we will not you seriously is.
13
00:00:45,330 --> 00:00:46,110
Let's take a look.
14
00:00:46,230 --> 00:00:51,480
So basically the formula, the general formula for if you will not be serious, looks like this.
15
00:00:51,840 --> 00:00:57,570
So the first element when An equals two zero, when the index is zero, the first element, the value
16
00:00:57,570 --> 00:00:58,980
is going to be zero.
17
00:00:59,490 --> 00:01:05,710
The next element for an equals, the one when the index equals to one, the value will be one.
18
00:01:05,710 --> 00:01:07,410
And we can see it right here.
19
00:01:07,530 --> 00:01:14,580
And then every next element in these feeble notches serious is going to be calculated as the sum of
20
00:01:14,580 --> 00:01:16,530
the two previous elements.
21
00:01:16,680 --> 00:01:19,700
So, for example, we know that the first element is zero.
22
00:01:19,800 --> 00:01:24,510
Then we have one and then we have the of the F for an equals two.
23
00:01:24,510 --> 00:01:24,900
Two.
24
00:01:24,930 --> 00:01:25,290
Right.
25
00:01:25,560 --> 00:01:28,440
We can see the formula if An is greater than one.
26
00:01:28,800 --> 00:01:30,540
So F of two equals two.
27
00:01:30,570 --> 00:01:35,670
F of one which is one plus F of zero, which is zero.
28
00:01:35,790 --> 00:01:38,070
And it will give us a total of one.
29
00:01:38,220 --> 00:01:44,130
And then also in the same way you find what will be the value for an equals two three, which is the
30
00:01:44,130 --> 00:01:48,810
total of the value of F two plus the value of F one.
31
00:01:48,960 --> 00:01:52,860
So if we take further loop, for example, the series will look like this.
32
00:01:53,100 --> 00:01:57,660
So for index zero, for index zero will have the value of zero.
33
00:01:57,690 --> 00:01:57,960
Right.
34
00:01:58,020 --> 00:01:59,970
That's based on the formula here.
35
00:02:00,090 --> 00:02:02,670
And for index one, when N equals two one.
36
00:02:02,670 --> 00:02:02,940
Right.
37
00:02:03,000 --> 00:02:09,450
This line is for the index for N when N equals two one, that the value is also going to be one.
38
00:02:09,480 --> 00:02:10,560
And we can see it here.
39
00:02:10,680 --> 00:02:18,750
And then we know that we found out that F of one is one and F of two will be equal to F one plus F zero.
40
00:02:18,990 --> 00:02:26,320
So if one plus F zero will give us one plus zero, which is a total of one, that's basically the serious
41
00:02:26,370 --> 00:02:27,040
Fibonacci.
42
00:02:27,210 --> 00:02:34,440
And if we want to find out what will be F three or four, we just take the sum of the two previous value
43
00:02:34,710 --> 00:02:38,370
for these given value that we want to find out.
44
00:02:38,520 --> 00:02:41,730
So F of three equals two, F of two plus F of one.
45
00:02:41,790 --> 00:02:44,370
And we know both of them, which is one and one.
46
00:02:44,610 --> 00:02:48,140
And the total result will be two and four for.
47
00:02:48,420 --> 00:02:51,360
We can see that it will be equals to F three plus F two.
48
00:02:51,360 --> 00:02:55,200
And we know that it's just two plus one, which is a total of three.
49
00:02:55,650 --> 00:03:01,470
And if we wanted to find out what will be F five, it will be just three plus two, which is five and
50
00:03:01,470 --> 00:03:02,070
so on.
51
00:03:02,100 --> 00:03:07,060
You got the idea how to find all the elements are in the feeble natsheh serious.
52
00:03:07,620 --> 00:03:14,040
And what you have to do is to write a recursive function, a recursive Fibonacci function that will
53
00:03:14,040 --> 00:03:21,170
get some n some index and you will find out and return the value and index N.
54
00:03:21,420 --> 00:03:27,030
So if it will receive an index of three, if it will receive an equals two three.
55
00:03:27,120 --> 00:03:33,900
Then the function is going to return to and if the function will receive N for example, five.
56
00:03:34,200 --> 00:03:36,420
So the function will return five.
57
00:03:36,430 --> 00:03:36,660
Right.
58
00:03:36,690 --> 00:03:42,150
Because five for index five, the value is calculated by the sum of two and three.
59
00:03:42,600 --> 00:03:50,700
So this result should not be done or calculated in an iterative approach, but rather it should be done
60
00:03:50,730 --> 00:03:52,260
using a recursion.
61
00:03:52,380 --> 00:03:57,570
So take your time, think of the solution and I'll see you in the Solutions video.
62
00:03:57,840 --> 00:03:58,530
Good luck, guys.
5864
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.