1
00:00:01,770 --> 00:00:02,469
Hi, everyone.

2
00:00:02,490 --> 00:00:07,880
So in this video, we are going to solve this question, bent all the positions of the element.

3
00:00:08,340 --> 00:00:16,020
So given an area, let's say the area has elements five, five, six, five and six.

4
00:00:16,260 --> 00:00:20,040
And let's say the index are zero, one, two, three and four.

5
00:00:20,050 --> 00:00:23,640
So they will be available to the value of X is five.

6
00:00:24,000 --> 00:00:27,620
So five is present zero at the next one and at the next three.

7
00:00:27,870 --> 00:00:29,810
So you need to print all the position.

8
00:00:30,150 --> 00:00:31,320
So I will bring to zero.

9
00:00:31,320 --> 00:00:33,000
I will print one, I will print three.

10
00:00:33,690 --> 00:00:39,780
Let's say the value of X is six, so six is present at next to at the next four and we need to print

11
00:00:39,780 --> 00:00:41,820
all the positions of the element.

12
00:00:42,120 --> 00:00:47,830
So I will print it next to I will print the next four, let's say, the value of existence.

13
00:00:48,090 --> 00:00:53,850
So ten is not present in this area, so I will not print anything simple answer the problem.

14
00:00:54,150 --> 00:00:59,370
So very simple way to solve this problem is using four Lopevi loop and how we can solve this problem.

15
00:00:59,370 --> 00:01:04,680
Just write it over and as soon as you find the element, just print the index and move ahead.

16
00:01:05,069 --> 00:01:10,260
So as soon as you again find the element, print the index and continue updating our.

17
00:01:10,920 --> 00:01:16,280
So when you reach the end of that, you will stop iterating and then you have to do it answered.

18
00:01:17,550 --> 00:01:22,860
So since we are learning religion, so we will solve this problem using recursion and we can use exactly

19
00:01:22,860 --> 00:01:24,630
the same approach, what we will do.

20
00:01:25,610 --> 00:01:27,620
So we will treat ordinary.

21
00:01:28,630 --> 00:01:33,970
We will light it over the area, we need to get it over the area and we are using recursion so we know

22
00:01:34,300 --> 00:01:37,600
how to iterate over the area using recursion.

23
00:01:37,750 --> 00:01:43,480
So we just need to take a variable eye so we already see how we can get it over the area.

24
00:01:43,480 --> 00:01:46,530
Using recursion just need to maintain a variable eye.

25
00:01:46,540 --> 00:01:51,430
So I will start from zero when I when I will reach and I will stop.

26
00:01:52,880 --> 00:01:58,940
So let's write the cold, so let's see, I don't have the function will be void because I'm only printing,

27
00:01:59,240 --> 00:02:04,670
so print all we need to print all position, so print all.

28
00:02:05,720 --> 00:02:09,139
Position, I will take Eddie as input.

29
00:02:10,380 --> 00:02:14,490
I will take and I will take it next, I do it right over the edge.

30
00:02:15,480 --> 00:02:16,170
So if.

31
00:02:17,470 --> 00:02:25,330
If I Regis and that means we need to stop, so return, I am stopping, otherwise check.

32
00:02:25,870 --> 00:02:27,070
So if I.

33
00:02:28,230 --> 00:02:31,380
Is it close to X, so we need to take X also.

34
00:02:35,600 --> 00:02:39,860
So if I equals X, I have to spend the next Soucy out, I.

35
00:02:44,940 --> 00:02:48,610
And call that equation, we need to move ahead, we will not stop.

36
00:02:48,630 --> 00:02:54,240
OK, so here after printing the eight, we will not stop by trading the we need to continue our trading

37
00:02:54,240 --> 00:02:56,910
over till we reach the last index index.

38
00:02:56,910 --> 00:03:00,260
And so print all position, we will not stop.

39
00:03:00,270 --> 00:03:01,280
We need to move ahead.

40
00:03:01,320 --> 00:03:02,730
So E and.

41
00:03:04,490 --> 00:03:08,760
And I plus one move ahead, so I think our function will work.

42
00:03:09,200 --> 00:03:11,240
Let's copy this function Brendel position.

43
00:03:13,950 --> 00:03:20,850
So a number of elements, six, let's say, I want to paint, I want to find out all the index of five.

44
00:03:21,780 --> 00:03:23,310
I will start from zero.

45
00:03:25,150 --> 00:03:26,700
See how this function is working.

46
00:03:29,090 --> 00:03:30,050
So this is our area.

47
00:03:30,080 --> 00:03:37,600
Five, five, six, five, six and seven, so I am putting the value of a which is zero.

48
00:03:38,180 --> 00:03:40,790
So I is standing here, so I will check.

49
00:03:42,200 --> 00:03:44,660
And the value of X is basically five.

50
00:03:44,660 --> 00:03:46,130
So five equals five.

51
00:03:46,130 --> 00:03:48,310
Yes, Brent I the value of zero.

52
00:03:48,620 --> 00:03:50,000
So this is my output.

53
00:03:50,480 --> 00:03:53,300
So I will print zero and then move ahead.

54
00:03:53,300 --> 00:03:54,320
So I will come here.

55
00:03:54,740 --> 00:03:56,510
So this is next recursion call.

56
00:03:57,140 --> 00:03:59,780
OK, and it will not change and will not change.

57
00:03:59,810 --> 00:04:00,900
So this is next recording.

58
00:04:00,940 --> 00:04:05,110
Call this as I say again, five equals five, the value of Axis five.

59
00:04:05,120 --> 00:04:07,930
So we will print one next equation call.

60
00:04:07,970 --> 00:04:08,830
I will come here.

61
00:04:09,350 --> 00:04:11,600
So six equals five do not do anything.

62
00:04:11,900 --> 00:04:14,210
So move ahead.

63
00:04:14,210 --> 00:04:14,920
So I will move.

64
00:04:15,090 --> 00:04:17,440
This is the next recording call I will print.

65
00:04:17,720 --> 00:04:20,120
So the next fight is basically three.

66
00:04:20,839 --> 00:04:24,070
I will print three and then move ahead.

67
00:04:24,740 --> 00:04:26,990
So six is not close to five Movahed.

68
00:04:28,000 --> 00:04:33,580
Seven is not close question, five more world, so I will reach the last six and then they're done and

69
00:04:33,580 --> 00:04:35,260
this is my output zero one three.

70
00:04:36,540 --> 00:04:38,040
So, Richard, zero three.

71
00:04:39,850 --> 00:04:41,470
And the output is zero one entry.

72
00:04:43,800 --> 00:04:51,060
Let's say I want to search for sex, for sex output should be this zero one, two, three and four output

73
00:04:51,060 --> 00:04:51,960
should be two and four.

74
00:04:53,640 --> 00:04:57,450
So I put this to end for now, let's try to search for seven.

75
00:04:58,910 --> 00:05:00,140
Output should be five.

76
00:05:01,120 --> 00:05:04,900
And output is coming out to be five and let's try one case.

77
00:05:06,570 --> 00:05:09,570
In which the element does not present, so then is not present inside the.

78
00:05:10,140 --> 00:05:11,490
So I will not bring anything.

79
00:05:11,760 --> 00:05:13,110
So I'm not printing anything.

80
00:05:14,840 --> 00:05:17,850
So our function is working, so this is it from this video.

81
00:05:17,870 --> 00:05:19,070
I will see you in the next one.

