All language subtitles for 14. Finding Minimum Value in a Sequence of Elements

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt-PT Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,750 --> 00:00:02,560 So what is going on, guys? 2 00:00:02,580 --> 00:00:07,830 And welcome back to another very interesting video in our programming course. 3 00:00:08,460 --> 00:00:16,860 And in the previous video, we started to talk and we also did some example regarding a recursive function 4 00:00:17,430 --> 00:00:25,800 that all it had to do is just to get some natural number, which was knowm in this case to read a sequence 5 00:00:25,800 --> 00:00:28,210 of numbers from the user. 6 00:00:28,310 --> 00:00:36,780 OK, so basically a sequence of NUM numbers and then the function should return the maximum value in 7 00:00:36,780 --> 00:00:37,950 this sequence. 8 00:00:38,460 --> 00:00:45,270 And as we said previously, this can be done simply by using some for a loop and that's it. 9 00:00:45,630 --> 00:00:53,100 But we need it and we solved it using the recursive approach by writing a recursive function. 10 00:00:53,970 --> 00:01:02,280 And in this video, what we are going to do is simply to modify a little bit this question, and instead 11 00:01:02,280 --> 00:01:07,950 of returning the maximum value, we will return the minimum value. 12 00:01:08,070 --> 00:01:08,630 All right. 13 00:01:09,030 --> 00:01:10,560 So that's not a big deal. 14 00:01:10,560 --> 00:01:15,030 But still, I want to like to go over this exercise together. 15 00:01:15,030 --> 00:01:21,120 So I've left also that template of the solution of the previous solution. 16 00:01:21,450 --> 00:01:28,530 And we are just going to modify a couple of things and to make sure that we understand once again the 17 00:01:28,530 --> 00:01:35,130 whole concept and the whole process of solving this exercise using recursion functions. 18 00:01:35,700 --> 00:01:39,750 So with that being said, let's start working. 19 00:01:39,900 --> 00:01:43,860 OK, so basically let's just modify the previous. 20 00:01:44,220 --> 00:01:50,520 So so if we have this example of equal to equals to three and we have this sequence of one, three, 21 00:01:50,520 --> 00:01:51,870 two in this example. 22 00:01:52,200 --> 00:01:59,970 So now basically defined main function should return the value of one because that's the most the minimum 23 00:01:59,970 --> 00:02:02,020 value in this sequence. 24 00:02:02,880 --> 00:02:11,610 So let's first of all modify these find marks to be find mean and we will have also int num and now 25 00:02:11,610 --> 00:02:19,140 we will simply also modify the variables names so minimal so far and the user input, user input is 26 00:02:19,140 --> 00:02:25,980 going to remain the same in what we are going to do is just also modify it here. 27 00:02:25,980 --> 00:02:37,190 So minimum so far, find minimum for now, minus one in minimum so far and know basically about that. 28 00:02:37,200 --> 00:02:38,890 I want to talk to you guys. 29 00:02:38,910 --> 00:02:39,450 OK, so. 30 00:02:40,790 --> 00:02:42,790 OK, what do we want to do? 31 00:02:43,250 --> 00:02:46,700 Basically, we want to write this function to be. 32 00:02:47,760 --> 00:02:56,580 To have some some general structure, that's all it will be able to do is to find the minimum for a 33 00:02:56,580 --> 00:03:00,340 given sequence of numbers that it's going to read from the user. 34 00:03:00,360 --> 00:03:07,500 So if we have three numbers, these find mean for the value of three will be able to find the minimum 35 00:03:07,500 --> 00:03:09,950 value in a sequence of three numbers. 36 00:03:10,620 --> 00:03:17,760 Then in a recursive call, we are going to call these function again, find meaning with the value of 37 00:03:17,760 --> 00:03:18,280 two. 38 00:03:18,300 --> 00:03:23,700 And then we will assume that the function find men will be able to find the minimum value between the 39 00:03:23,700 --> 00:03:24,060 two. 40 00:03:24,720 --> 00:03:26,730 And as we said also previously. 41 00:03:26,790 --> 00:03:33,330 Again, that's very important for you to maybe to write it down, I don't know, make some note or whatever 42 00:03:34,030 --> 00:03:35,250 guys you're working with. 43 00:03:35,910 --> 00:03:42,990 Basically, the base case is for this function find mean for economic woes to one. 44 00:03:43,410 --> 00:03:53,250 That means that we want to find the minimum, OK, when we have a sequence of just one number and that's 45 00:03:53,250 --> 00:03:56,810 the base case using these recursion function. 46 00:03:57,240 --> 00:04:04,650 And if we know that we if we have just one number, then definitely this number in this sequence, which 47 00:04:04,650 --> 00:04:10,530 is the user input, that's definitely the number that is going to be returned. 48 00:04:10,560 --> 00:04:11,100 OK. 49 00:04:11,990 --> 00:04:12,590 Awesome. 50 00:04:12,950 --> 00:04:19,970 So that's also something that I wanted to say in the previous video, but I decided that I will edit 51 00:04:19,970 --> 00:04:20,650 in this one. 52 00:04:20,840 --> 00:04:23,210 So the approach was like this. 53 00:04:23,600 --> 00:04:25,310 We are making some function. 54 00:04:25,310 --> 00:04:29,850 If we are talking about the previous video, we had like find marks for a given name. 55 00:04:30,320 --> 00:04:38,990 So basically, if we will generalize the function or functionality it can get, the previous function 56 00:04:38,990 --> 00:04:47,540 can get some number, OK, which will represent a sequence that this function will be able to return 57 00:04:47,540 --> 00:04:54,590 the maximum value or like in this case, in our current exercise, it will be able to return the minimum 58 00:04:54,590 --> 00:04:55,130 value. 59 00:04:55,400 --> 00:04:56,000 All right. 60 00:04:56,660 --> 00:04:57,160 Awesome. 61 00:04:57,200 --> 00:04:58,160 So now. 62 00:04:59,200 --> 00:05:05,650 What we have to do is basically to go with pretty much the same approach and ask the following question, 63 00:05:05,650 --> 00:05:07,240 we are looking for the minimum. 64 00:05:07,240 --> 00:05:10,990 So far, so minimal, so far equals to find minimum. 65 00:05:11,000 --> 00:05:12,880 So far, that's not a problem. 66 00:05:12,890 --> 00:05:15,850 That's something that we we've done also previously. 67 00:05:16,810 --> 00:05:21,780 And now we are going just probably to add these conditions. 68 00:05:21,780 --> 00:05:26,920 So if the user input is less than the minimum so far. 69 00:05:27,250 --> 00:05:34,810 OK, so if that's the case, if the current input is less than the minimum so far received from the 70 00:05:34,810 --> 00:05:43,270 user in this sequence, then in this case we will return the user input and otherwise we will return 71 00:05:43,360 --> 00:05:45,760 the minimum so far. 72 00:05:46,300 --> 00:05:50,980 OK, so that's basically it for what I wanted to show you for this exercise. 73 00:05:50,990 --> 00:05:56,500 Let's maybe build and run it to see and to make sure that everything works pretty much as we expected. 74 00:05:57,100 --> 00:06:03,160 So let's go and build and run it building run so into a number three. 75 00:06:03,160 --> 00:06:04,980 So a will. 76 00:06:05,170 --> 00:06:06,900 What happened, what happened up? 77 00:06:06,910 --> 00:06:10,090 We didn't call the function, so let's just call the function. 78 00:06:10,360 --> 00:06:11,860 What's its name find mean. 79 00:06:12,190 --> 00:06:22,240 So find me and then we will specify the number which these cases num let's build and run it once again. 80 00:06:22,840 --> 00:06:26,170 So enter number three, you now enter an input. 81 00:06:26,170 --> 00:06:28,960 So we said what was it in this example. 82 00:06:28,960 --> 00:06:32,020 One, two, three, two, so one, three and two. 83 00:06:32,230 --> 00:06:39,400 And we expect that this function, using this recursive approach, recursive manner will return the 84 00:06:39,400 --> 00:06:45,840 value of one since this value is the most at the minimum. 85 00:06:46,060 --> 00:06:47,440 OK, awesome. 86 00:06:47,440 --> 00:06:50,320 So presenter and then what happened? 87 00:06:50,470 --> 00:06:53,500 Oh, nothing happened because we didn't read the result. 88 00:06:53,680 --> 00:07:03,340 Sorry you guys basically let's do it like end resolved so resolved equals to find mean so let's build 89 00:07:03,340 --> 00:07:04,360 and run it. 90 00:07:05,020 --> 00:07:12,640 So build and run it into a number three, enter a number three, one, three and two. 91 00:07:12,670 --> 00:07:17,020 And what happened at the end printed this video. 92 00:07:17,020 --> 00:07:18,760 Is something OK because. 93 00:07:21,100 --> 00:07:30,310 The minimum value equals to the problem when you take some some exercise and you want to like to modify 94 00:07:30,310 --> 00:07:36,970 one thing into running to make sure that everything is understandable, but not going into all the details. 95 00:07:37,120 --> 00:07:40,780 So a lot of times things get messed up. 96 00:07:40,780 --> 00:07:42,120 So enter a number. 97 00:07:42,160 --> 00:07:43,540 Hopefully this one will work. 98 00:07:43,750 --> 00:07:48,820 So three, one, three and two and the minimum value equals to one. 99 00:07:49,750 --> 00:07:53,190 So basically, this is it for these video guys. 100 00:07:53,200 --> 00:07:54,450 I hope you like it. 101 00:07:54,460 --> 00:07:57,860 I hope you found it very, very useful. 102 00:07:58,120 --> 00:08:00,380 Make sure you can write this function on your own. 103 00:08:00,520 --> 00:08:01,630 Keep on practicing. 104 00:08:01,630 --> 00:08:04,870 And we are going to see each other in the next videos. 105 00:08:05,120 --> 00:08:06,580 Until then, bye bye. 10067

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.