1
00:00:01,730 --> 00:00:02,390
Hello everyone.

2
00:00:02,410 --> 00:00:03,410
Welcome to the session.

3
00:00:03,410 --> 00:00:06,680
So today we will solve my problem with the help of the occasion.

4
00:00:06,680 --> 00:00:11,340
So the name of the problem is dramatic some ok do some genetic some.

5
00:00:11,540 --> 00:00:14,080
Now what is the problem so the problem is very simple.

6
00:00:14,120 --> 00:00:17,150
So given the value let's say the value of Case Three.

7
00:00:17,180 --> 00:00:22,210
So what we have to do we have to calculate the cities we have to convert the sum of our cities.

8
00:00:22,210 --> 00:00:24,000
Now the cities is very simple.

9
00:00:24,080 --> 00:00:27,970
So this will be the cities to the power too.

10
00:00:27,980 --> 00:00:31,710
And this is true to the poverty because the value of K Street.

11
00:00:31,730 --> 00:00:33,170
So I will go.

12
00:00:33,170 --> 00:00:34,220
So I will reach here.

13
00:00:34,250 --> 00:00:34,610
OK.

14
00:00:34,610 --> 00:00:39,800
One upon two to the power three basically in chart for a general key for a general cadence it is will

15
00:00:39,800 --> 00:00:48,630
look something like this when I bought two plus two square two cube and so on.

16
00:00:48,730 --> 00:00:51,020
One when two to the power game minus one.

17
00:00:51,050 --> 00:00:53,540
Then one upon two to the power key.

18
00:00:53,640 --> 00:00:57,820
Okay so we have to calculate the sum of the cities for a general key.

19
00:00:58,120 --> 00:00:58,480
Okay.

20
00:00:58,490 --> 00:01:00,840
The value of game will be given by the user.

21
00:01:00,980 --> 00:01:03,470
And this is how the cities will look like.

22
00:01:03,470 --> 00:01:06,210
So we have to use recursion to solve this problem.

23
00:01:06,230 --> 00:01:09,140
Okay so how we can use recursion to solve this problem.

24
00:01:09,140 --> 00:01:12,630
So what we will do we will break the series into okay.

25
00:01:12,680 --> 00:01:15,020
So this is basically true to the power about zero.

26
00:01:15,020 --> 00:01:18,020
Okay now we have a bigger problem.

27
00:01:18,020 --> 00:01:22,030
So with the help of the guys in what we will do we will give the smaller problem to that equation.

28
00:01:22,040 --> 00:01:32,430
So I will big the cities from here so if this total cities if I call it G some K so if I'm calling this

29
00:01:32,430 --> 00:01:37,250
total cities as geometric some K so what will the cities be called.

30
00:01:37,860 --> 00:01:39,080
So what is this series.

31
00:01:39,090 --> 00:01:45,230
So this series is nothing but this is geometric sum game minus 1.

32
00:01:45,430 --> 00:01:49,370
Okay so the equation will give me the answer for the cities okay.

33
00:01:49,490 --> 00:01:55,240
Recursion I believe recursion I believe the function equation will give me the answer for the cities.

34
00:01:55,260 --> 00:01:59,900
And after getting done I said what we will do I have to calculate this part.

35
00:01:59,910 --> 00:02:03,100
So this part is not a thing but it is just one divided by two.

36
00:02:03,140 --> 00:02:06,450
The power key so we can use the power function here.

37
00:02:06,450 --> 00:02:08,770
Power of the power key.

38
00:02:08,970 --> 00:02:09,230
Okay.

39
00:02:09,240 --> 00:02:11,100
And that is how we will get our answer.

40
00:02:11,730 --> 00:02:17,370
Okay so let us write the code now first of all before writing the code word we would answer for this

41
00:02:17,400 --> 00:02:19,360
when the value of case 3.

42
00:02:19,380 --> 00:02:20,340
So what do we answer.

43
00:02:20,370 --> 00:02:21,510
This will be one plus.

44
00:02:21,870 --> 00:02:22,790
So one by two.

45
00:02:22,800 --> 00:02:25,590
This is zero point five when by four.

46
00:02:25,620 --> 00:02:31,390
This will be zero point to five and then one by eight.

47
00:02:31,390 --> 00:02:35,710
So basically this will be zero point 1 2 5.

48
00:02:35,710 --> 00:02:39,520
So if we will add these four times we will get one point eight seven five.

49
00:02:39,970 --> 00:02:42,560
So basically our return type will be a double.

50
00:02:42,610 --> 00:02:43,000
Okay.

51
00:02:43,060 --> 00:02:44,580
This will be a double fluid.

52
00:02:44,590 --> 00:02:46,150
It will not be an integer.

53
00:02:46,150 --> 00:02:49,080
Okay now let us write the code and we will check.

54
00:02:49,090 --> 00:02:52,500
We will run our code against the value of equals 3.

55
00:02:52,770 --> 00:02:55,460
Okay so let's write the code

56
00:02:59,240 --> 00:03:06,900
so the return table will not be in digits sorry the return type will be double so I don't double double

57
00:03:06,930 --> 00:03:12,930
and let's say that maybe the function is geometric sum so GSM what it will take it will take a number

58
00:03:12,930 --> 00:03:14,430
as argument.

59
00:03:14,430 --> 00:03:14,700
Okay.

60
00:03:14,700 --> 00:03:19,110
So first of all base case we have to think about the base case.

61
00:03:19,140 --> 00:03:22,440
So if the value of k is 0 so what is the answer.

62
00:03:22,440 --> 00:03:23,520
If the value of k 0

63
00:03:27,750 --> 00:03:34,380
Okay so let's see again so if the value of k 0 is the value of case zero what is the cities.

64
00:03:34,430 --> 00:03:37,630
So the cities will be simply this one okay.

65
00:03:37,650 --> 00:03:47,540
For k equals zero I will say this will be one plus one divided by not one plus two to the power zero.

66
00:03:47,570 --> 00:03:54,160
Okay so this will be our city's fault because it'll This is our cities okay.

67
00:03:54,320 --> 00:03:58,090
For k was 3 so I will go till 3 when the value of k 0.

68
00:03:58,110 --> 00:04:02,520
I will go only this much okay.

69
00:04:02,520 --> 00:04:06,250
Only one time when the value of cake was you know I have only one item.

70
00:04:06,390 --> 00:04:08,210
So this is nothing but one by one.

71
00:04:08,230 --> 00:04:09,350
So this is one.

72
00:04:09,390 --> 00:04:10,230
Okay so what.

73
00:04:10,260 --> 00:04:11,300
This is our base case.

74
00:04:11,310 --> 00:04:14,070
If the value of KS is 0 I would answer this one.

75
00:04:14,160 --> 00:04:14,430
Okay.

76
00:04:15,470 --> 00:04:20,490
This is our base case so the value of Casey doing what I have to do.

77
00:04:20,520 --> 00:04:22,270
I have not done one.

78
00:04:22,710 --> 00:04:24,660
Now what do we do.

79
00:04:24,660 --> 00:04:29,100
Recursive case so the equation will give me the answer for the smaller problem.

80
00:04:29,140 --> 00:04:31,760
Okay so I will are done.

81
00:04:31,980 --> 00:04:38,520
I will store down in a double variable and so double small onset because the return type is double.

82
00:04:38,680 --> 00:04:40,410
So geometric sum

83
00:04:43,430 --> 00:04:50,730
I will give give minus 1 to domestic some will give me the dramatic sum of game minus one times and

84
00:04:50,730 --> 00:04:56,760
now the calculation but so the calculation part is very easy.

85
00:04:56,970 --> 00:05:00,510
What I have to do I have to calculate one thing.

86
00:05:00,750 --> 00:05:04,890
So I will return small answer plus.

87
00:05:05,310 --> 00:05:08,910
Now what we have to do we have to calculate this part okay.

88
00:05:08,940 --> 00:05:12,640
This is our last digit.

89
00:05:12,750 --> 00:05:14,980
So this is the last digit.

90
00:05:15,090 --> 00:05:16,010
This is the last digit.

91
00:05:16,020 --> 00:05:17,670
I have to calculate this last digit.

92
00:05:18,090 --> 00:05:25,610
So what I will do I will write when divided by two to the power key but this will be wrong because this

93
00:05:25,610 --> 00:05:29,370
is integer and this is in data and digit upon A.J. will be in Indonesia.

94
00:05:29,390 --> 00:05:30,900
But I want double value.

95
00:05:30,920 --> 00:05:31,620
Okay.

96
00:05:31,820 --> 00:05:34,770
So what I will do I will write one point zero.

97
00:05:34,870 --> 00:05:39,230
Okay so that I can get done so as double.

98
00:05:39,230 --> 00:05:41,390
So I will write to one point zero.

99
00:05:41,630 --> 00:05:43,580
So double up on it T.J. will be the one only.

100
00:05:43,580 --> 00:05:45,710
And then I am using powered function.

101
00:05:45,980 --> 00:05:48,950
So power function takes two things as argument.

102
00:05:48,950 --> 00:05:55,390
So I have to conclude it to the power key we can see here.

103
00:05:55,410 --> 00:05:59,220
I have to calculate to the power key okay.

104
00:05:59,240 --> 00:06:01,630
So this will be our code where the simple code.

105
00:06:01,640 --> 00:06:09,380
And now let us this double code let us call the G some function and later the value of Case 3 and 4

106
00:06:09,380 --> 00:06:12,340
3 we know the so should be one point eight seven five.

107
00:06:12,500 --> 00:06:20,090
Okay let's run our file so our answer is one point eighty seven five solver code is working fine.

108
00:06:20,090 --> 00:06:21,620
And if you want we can also do it.

109
00:06:21,740 --> 00:06:23,240
We can also died in our court.

110
00:06:23,240 --> 00:06:24,710
We can draw the diagram.

111
00:06:25,310 --> 00:06:30,920
So the value of case T okay so case not too close to zero.

112
00:06:30,920 --> 00:06:31,780
I will calculate.

113
00:06:31,790 --> 00:06:33,830
I will call the function for 2.

114
00:06:34,160 --> 00:06:36,060
Then I will call the function for 1.

115
00:06:36,260 --> 00:06:38,120
Then I will call the function for 0.

116
00:06:38,660 --> 00:06:43,450
So if the value of k 0 I am returning 1 so it will return 1.

117
00:06:43,460 --> 00:06:50,800
So basically the small answer contains 1 and then what I am doing I am calculating I am returning small

118
00:06:50,800 --> 00:06:58,230
answers I am returning small answer which is one plus one divided by 2 to the power key case one only.

119
00:06:58,250 --> 00:07:06,610
Okay so what I am returning so this is basically one plus this is zero point five.

120
00:07:06,640 --> 00:07:07,900
So basically one point five.

121
00:07:07,930 --> 00:07:13,900
So this answer for that sort so the smaller answer is one point five and then I am again small answer

122
00:07:13,900 --> 00:07:14,810
plus this part.

123
00:07:15,400 --> 00:07:22,270
So basically what I am returning I am returning when playing five plus one divided by two squared because

124
00:07:22,270 --> 00:07:26,690
the value of Case 2 so 1 divided by 4 when my 4.

125
00:07:26,740 --> 00:07:28,060
So what is 1 before.

126
00:07:28,090 --> 00:07:31,540
So when therefore is zero point to five.

127
00:07:31,630 --> 00:07:38,500
So one point five plus zero point two five so one point five plus point two five.

128
00:07:38,560 --> 00:07:40,930
So this will be five seven one point seven five.

129
00:07:41,260 --> 00:07:43,960
So the small answer is one point seven five.

130
00:07:43,960 --> 00:07:47,490
And then again the value of Case Three.

131
00:07:47,680 --> 00:07:50,720
So a small answer plus one by eight.

132
00:07:50,830 --> 00:07:55,750
And this will be one point eight seven five okay.

133
00:07:56,920 --> 00:07:59,520
So when by it is zero point twenty five.

134
00:07:59,530 --> 00:08:03,810
So if I will add one point seven five and zero point one two five.

135
00:08:03,850 --> 00:08:06,640
So this is five seven eight and one point eight seven five.

136
00:08:06,670 --> 00:08:11,310
So this is how that's how we will get our answer it will be one point eighty seven five.

137
00:08:11,320 --> 00:08:12,010
Okay.

138
00:08:12,100 --> 00:08:13,960
So I hope you understood this problem also.

139
00:08:14,920 --> 00:08:16,780
Okay so that 10 day will be double.

140
00:08:16,840 --> 00:08:20,620
And first we will write the code then we will think of the diagram.

141
00:08:20,710 --> 00:08:22,950
Okay then we will write and I will call it first.

142
00:08:22,950 --> 00:08:27,550
Write the code and then first write the code with the help of PMI and then draw the diagram.

143
00:08:27,550 --> 00:08:27,990
Okay.

144
00:08:28,120 --> 00:08:29,760
So I hope you understood this problem also.

145
00:08:29,770 --> 00:08:31,950
If you're having it out you can definitely ask me.

146
00:08:31,990 --> 00:08:33,210
Okay thank you.
