1
00:00:01,640 --> 00:00:03,390
Hello, everyone, welcome to this session.

2
00:00:03,410 --> 00:00:08,400
So today we will solve one more problem with the help of the so the name of the problem is genetics.

3
00:00:08,690 --> 00:00:11,000
OK, Jaeson, genetics.

4
00:00:11,450 --> 00:00:12,320
Now, what is the problem?

5
00:00:12,430 --> 00:00:13,710
The problem is very simple.

6
00:00:14,030 --> 00:00:19,190
So given the value, let's say, the value of Kastari, so what we have to do, we have to calculate

7
00:00:19,610 --> 00:00:20,390
the seeds.

8
00:00:20,390 --> 00:00:21,860
We have to convert the sum of series.

9
00:00:22,130 --> 00:00:23,450
Now, the series is very simple.

10
00:00:24,020 --> 00:00:25,970
So this will be the series.

11
00:00:27,210 --> 00:00:33,710
To the power to and this is truly the poverty because the value of K Street, so I will go so I will

12
00:00:33,710 --> 00:00:39,050
reach here, OK, when I point to the poverty, basically, in short for a general key, for a general

13
00:00:39,050 --> 00:00:44,840
CAYLUS, it is will look something like this when bought two plus two square.

14
00:00:46,460 --> 00:00:52,910
Tokyo and so on, tell when point to the power game, minus one and then one upon the power.

15
00:00:53,490 --> 00:00:57,560
OK, so we have to calculate the sum of the cities for a general.

16
00:00:58,040 --> 00:01:03,130
OK, the value of K will be given by the user and this is how the cities will look like.

17
00:01:03,440 --> 00:01:05,960
So we have to use recursion to solve this problem.

18
00:01:06,110 --> 00:01:09,140
OK, so how we can use recursion to solve this problem.

19
00:01:09,170 --> 00:01:12,660
So what we will do, we will break the cities into OK.

20
00:01:12,680 --> 00:01:14,780
So this is basically to to the power zero.

21
00:01:14,930 --> 00:01:17,960
OK, now we have a bigger problem.

22
00:01:17,970 --> 00:01:22,040
So with the help of the equation, what we will do, we will give the smaller problem to the recursion.

23
00:01:22,040 --> 00:01:23,780
So I will pick the cities from here.

24
00:01:25,050 --> 00:01:33,860
So if this total series, if I call it --, OK, so if I'm calling this total series as dramatic.

25
00:01:34,680 --> 00:01:37,200
So what will the series be called?

26
00:01:37,800 --> 00:01:39,030
So what is the series?

27
00:01:39,030 --> 00:01:43,710
So the series is nothing, but this is the sum game minus one.

28
00:01:45,270 --> 00:01:51,120
OK, so the question will give me the answer for this series, OK, recursion, I believe recursion.

29
00:01:51,120 --> 00:01:54,960
I believe the function recursion will give me the answer for the series.

30
00:01:55,170 --> 00:01:59,870
And after getting the answer, what we will do, I have to calculate this part.

31
00:01:59,880 --> 00:02:05,250
So this part is nothing, but it is just one divided by two, the power key so we can use the power

32
00:02:05,250 --> 00:02:05,900
function here.

33
00:02:06,390 --> 00:02:08,259
Power of truth, the power key.

34
00:02:08,860 --> 00:02:11,130
OK, and that's how we will get our answer.

35
00:02:11,660 --> 00:02:14,100
OK, so let us write the code now.

36
00:02:14,100 --> 00:02:18,720
First of all, before writing the code, what would be the answer for this when the value of Kastari

37
00:02:19,320 --> 00:02:22,760
so we are answered, this will be one plus one by two.

38
00:02:22,770 --> 00:02:25,610
This is zero point five, one by four.

39
00:02:25,620 --> 00:02:28,650
This will be zero point two five.

40
00:02:29,770 --> 00:02:36,760
And then one by eight, so basically this will be zero point one, two five, so if he will add these

41
00:02:36,760 --> 00:02:39,500
four times, we will get one point eight, seven five.

42
00:02:39,880 --> 00:02:42,370
So basically our return type will be double.

43
00:02:42,540 --> 00:02:44,530
OK, this will be a double offload.

44
00:02:44,530 --> 00:02:45,910
It will not be an integer.

45
00:02:46,070 --> 00:02:49,030
OK, now let us write the code and we will check.

46
00:02:49,030 --> 00:02:51,840
We will run our code against the value of equals three.

47
00:02:52,620 --> 00:02:53,050
OK.

48
00:02:54,200 --> 00:02:55,490
So let's ride the gold.

49
00:02:59,180 --> 00:02:59,660
So.

50
00:03:01,570 --> 00:03:04,650
There will not be intelligence or there will be a double.

51
00:03:05,730 --> 00:03:11,260
So they're trying to build a wall and let's say the name of the function is genetics, so -- what

52
00:03:11,340 --> 00:03:13,660
it will take, it will take a number as argument.

53
00:03:14,280 --> 00:03:19,110
OK, so first of all, best case, we have to think about the best case.

54
00:03:19,140 --> 00:03:22,420
So if the value of care is zero, so what is the answer?

55
00:03:22,440 --> 00:03:23,520
If the value of Kazue.

56
00:03:27,600 --> 00:03:28,950
OK, so let's see again.

57
00:03:30,320 --> 00:03:35,960
So if the value of Kizito is the value of Kasit over the cities, so the savings will be simply this

58
00:03:35,960 --> 00:03:36,170
one.

59
00:03:37,210 --> 00:03:42,910
OK, for gay couples, zero, our cities will be one plus one divided by.

60
00:03:44,680 --> 00:03:47,240
No one understood the power.

61
00:03:47,540 --> 00:03:51,050
OK, so this will be our city's for Khosro.

62
00:03:52,140 --> 00:03:58,080
This is our cities, OK, four gateways, three, so I will go till three when the value of K zero,

63
00:03:58,080 --> 00:04:00,450
I will go only this much.

64
00:04:02,100 --> 00:04:02,470
OK.

65
00:04:02,490 --> 00:04:07,800
Only one time when the earthquake was, you know, I have only one time, so this is nothing but one

66
00:04:07,800 --> 00:04:08,200
by one.

67
00:04:08,220 --> 00:04:09,060
So this is one.

68
00:04:09,300 --> 00:04:11,310
OK, so this is our base case.

69
00:04:11,330 --> 00:04:13,740
If the value of KS is zero, I would answer this one.

70
00:04:14,100 --> 00:04:14,460
OK.

71
00:04:15,440 --> 00:04:16,550
This is our base case.

72
00:04:18,480 --> 00:04:25,630
So the value of Casey doing what I have to do, I have to return well, now what will do recursive case.

73
00:04:25,650 --> 00:04:29,070
So the equation will give me the answer for the smaller problem.

74
00:04:29,100 --> 00:04:31,050
OK, so I will return.

75
00:04:31,860 --> 00:04:35,370
I will store down the variable so double, Smolan said.

76
00:04:36,540 --> 00:04:40,410
Because the return type is so dramatic, some.

77
00:04:43,320 --> 00:04:50,760
I will give give my innocent a dramatic some will give me the dramatic sum of game minus one times and

78
00:04:50,760 --> 00:04:51,990
now the calculation part.

79
00:04:54,510 --> 00:05:02,690
So the calculation part is very easy, would have to do I have to calculate one thing, so I will return

80
00:05:02,700 --> 00:05:03,530
Smolan answer.

81
00:05:04,230 --> 00:05:08,340
Plus now if we have to, do we have to calculate this part?

82
00:05:08,340 --> 00:05:10,140
OK, this is our last digit.

83
00:05:12,660 --> 00:05:14,010
So this is the last visit.

84
00:05:15,000 --> 00:05:17,650
This is the last digit I have to calculate this last digit.

85
00:05:18,030 --> 00:05:21,180
So what I will do, I will write one divided by.

86
00:05:22,910 --> 00:05:28,040
True to the power, but this will be wrong because this is issue and this is in beta and digital opponent

87
00:05:28,040 --> 00:05:30,870
T.J. will be an integer, but I want double value.

88
00:05:30,890 --> 00:05:34,010
OK, so what I will do, I will write 1.0.

89
00:05:34,790 --> 00:05:40,750
OK, so that I can get the answer as double, so I will write 1.0.

90
00:05:41,570 --> 00:05:45,440
So developing integer will be the one only and then I'm using power function.

91
00:05:45,980 --> 00:05:48,220
So that function takes two things as argument.

92
00:05:48,890 --> 00:05:51,010
So I have to calculate the power.

93
00:05:51,140 --> 00:05:51,440
OK.

94
00:05:52,520 --> 00:05:52,970
OK.

95
00:05:54,060 --> 00:05:57,000
We can see here I have to calculate the Bürki.

96
00:05:58,880 --> 00:06:00,540
OK, so this will be our goal.

97
00:06:00,740 --> 00:06:01,610
Very simple goal.

98
00:06:01,610 --> 00:06:03,130
And now let us test our gold.

99
00:06:03,630 --> 00:06:09,380
Let us call the some function and let the value of KS three and four.

100
00:06:09,380 --> 00:06:12,350
Trevino's so should be one point eight seven five.

101
00:06:12,410 --> 00:06:13,880
OK, let's try Neverfail.

102
00:06:15,620 --> 00:06:21,440
So our answer is one point eight seven five zero gold is working fine, and if you want, we can also

103
00:06:21,740 --> 00:06:23,230
we can also do that in our code.

104
00:06:23,240 --> 00:06:24,490
We can draw the diagram.

105
00:06:25,220 --> 00:06:26,840
So the value of Kastari.

106
00:06:28,220 --> 00:06:34,910
OK, so she's not close to zero, I will calculate I will call the function for two, then I will call

107
00:06:34,910 --> 00:06:38,040
the function for one, then I will call the function for zero.

108
00:06:38,600 --> 00:06:41,000
So if the value of K zero, I am returning one.

109
00:06:41,000 --> 00:06:42,440
So it will return one.

110
00:06:43,370 --> 00:06:50,420
So basically, the small answer contains one, and then what I am doing, I am calculating, I am returning

111
00:06:50,420 --> 00:06:57,260
small, sir, I am returning, Smolan said, which is one plus one divided by two to the basket case,

112
00:06:57,260 --> 00:06:57,800
one only.

113
00:06:58,130 --> 00:06:59,630
OK, so what?

114
00:06:59,630 --> 00:07:00,310
I'm returning.

115
00:07:00,710 --> 00:07:02,300
So this is basically.

116
00:07:03,670 --> 00:07:10,180
One plus, this is zero point five, so basically one point five, so answer for a smaller answer is

117
00:07:10,180 --> 00:07:14,800
one point five and then I imagine smaller surplus, this part.

118
00:07:15,340 --> 00:07:22,270
So basically what I'm returning I'm returning one point five plus one divided by two squared because

119
00:07:22,270 --> 00:07:26,420
the value of Kastel, so one divided by four when by four.

120
00:07:26,710 --> 00:07:28,060
So what is one before.

121
00:07:28,060 --> 00:07:31,560
So when Baffour is zero point two five.

122
00:07:31,600 --> 00:07:33,670
So one point five zero point two five.

123
00:07:34,900 --> 00:07:42,720
So one point five plus point two five, so this will be five seven one point seven five so small and

124
00:07:42,880 --> 00:07:43,960
is one point seven five.

125
00:07:43,960 --> 00:07:52,990
And then again, the value of Kastari, so small answer surplus one by eight and this will be one point

126
00:07:52,990 --> 00:07:53,830
eight seven five.

127
00:07:55,310 --> 00:07:55,760
OK.

128
00:07:56,860 --> 00:08:02,650
So when say it is zero point one to five, so if I will add one point seven five and zero point one

129
00:08:02,650 --> 00:08:06,640
to five, so this is five, seven, eight and one point eight seven five.

130
00:08:06,670 --> 00:08:10,790
So this is how that is how we will get our answer will be one point eight, seven five.

131
00:08:11,170 --> 00:08:13,920
OK, so I hope you understood this problem also.

132
00:08:14,830 --> 00:08:16,630
OK, so that it will be readable.

133
00:08:16,750 --> 00:08:20,670
And first we will write the code, then we will think of the diagram.

134
00:08:20,680 --> 00:08:25,630
OK, then we will write a novel called First Write the Code and then frustrate the court with the help

135
00:08:25,630 --> 00:08:27,460
of PMI and then draw the diagram.

136
00:08:27,490 --> 00:08:29,440
OK, so I hope you understood this problem.

137
00:08:29,440 --> 00:08:31,600
Also, if you have any doubt, you can definitely ask me.

138
00:08:31,930 --> 00:08:32,799
OK, thank you.

