All language subtitles for 4. Finding an Element within a List

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
ceb Cebuano
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
hmn Hmong
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
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
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 Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
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

Original subtitles

What is going on, guys, and in this video, what we are going to do is simply to write a function

that returns true.

If it has a node with the received value, otherwise it will return a false.

So simply saying the function should receive a linked list and some individual number and the function

should go through all the nodes of the list and return.

True, if this number exists in the list.

Otherwise, if it doesn't exist, if it doesn't exist, if it doesn't exist, we should return.

We should return.

False.

OK, so either a true or either false.

So this exercise is very similar to the exercise where we had to count how many nodes there are in the

list.

And this question, we also know that we have to do something similar and it is to iterate through the

lists nodes and make comparison between the received number and the data.

OK, the data field of each of the nodes, we are checking if there is a match, then we should return.

True, otherwise false.

And I think you got the point.

And this video is being taught right after the previous video where I talked to and explained to you

guys, what is the boolean data type and how you may also use it.

So now that you know how to use a boolean data type, whether it's true or false, then in this case

you will be able to use a Boolean function and boolean result.

So here we go.

We have our I hope the instructions are clear, OK, if something isn't clear, so pass the video and

even ask any questions of this chapter.

And what do we have here?

Is the structure of node.

OK.

Nothing, nothing new here.

And what we are going to do is to write a function.

We know that the function returns or at least it should return a boolean type.

So for that we will simply like include include just like a show to us, the D.

Bool s, the standard boolean dot age.

You know, what we are going to do is the type of the function is going to be bool, OK, because it's

either a true or false if we would have specified here integer and then we know that there is a wide

range of values that these function may return also positive, negative and so on.

So we want to like to minimize the options to being only either true or either false.

And the function is going to be is number in least.

OK, that's the name of the function.

Very descriptive.

It should be.

I hope it's pretty.

OK is no enlace.

OK.

And what we are going to do is we are going to receive a list.

OK, so node pointer header of the address of the first element of the head element of these particular

list and some integer number that we are going to look for in all of the nodes elements in this list.

OK, so next thing we are going to do in the body of the function is that we are going to initialize

some answer, let's call it to be equal to false.

So for example, boolean answer equals to false, OK, to false.

And then what we are going to do is to iterate over all the elements of this list.

So for that, let's create additional temp variable of type nodes.

Star temp equals to had.

This will be used for iterating over all the nodes and while temp next is longest temp next, that does

not equals to now meaning we haven't.

OK, we haven't.

While we still have additional additional nodes to explore, while that's the case, we are going to

see if a given a given a given node in the let's maybe instead of using templates use here at current

node that we are exploring.

So current node, current node, if the current node data, if its data is equal to Neme.

So that means that we have found out that there is a node with the data of nums.

So we found it out and we can say that answer equals two through in this case to true.

And in this case we can also not.

Return because I said that we should go through all the nodes.

OK, so if we have to go through all the nodes, then that's OK.

So let's use current node next.

Equal to our current node equals to current node next.

Just moving further, our current pointer in the case that we didn't find out.

And finally, finally, finally, we will return the end of the answer, OK?

Which is either true or false.

And you may be asking yourself, why do we even need these bool answer equals to false in the first

place and why didn't we return here?

The answer once we found out.

So we won't need to iterate even further and just to waste time.

And you are right, 100 percent, guys, because I just wanted to show you, because the question was

to go through all the nodes of the list.

OK, so there is really no reason to go through the next nodes of the list once you found out that number

exists in the digit of one of the nodes.

So in this case, you may return answering to finish the execution of the function.

And also there is actually no even reason to create this variable just for some convenience and explanation.

I created it.

Basically, what I would have done in this case is that if current node data equals equals dunam, so

in this case, return true.

OK.

And otherwise, if we have reached OK, we are out of this while loop only if we reached the end of

the of the list.

OK, and we didn't return through so far.

So definitely the answer would be that now we have to return false because we didn't find we did not

find the answer and num in any of the nodes in this list.

So I hope that's clear to you guys.

So once again, let's go over all the steps we've done here.

We received the head of the of the list and we received some number and we wanted to go over all the

elements of this linked list and to see if a given number, some arbitrary number that the user sends,

if this number, the function receives, if it is inside of some of the nodes in this list, if that's

the case, this function should return.

True.

And if it's not, then the function should return false.

And when we are going to call this function, it's going to be pretty much nice.

We are going to ask if he's numbering list and pass the list and a number and we will receive through.

If that's the case, if the number is inside of this list, otherwise we will receive false.

And based on this result, we will be able to, I don't know, to make some operations, seem to make

some conclusions and based on that, to execute different parts of code.

So thank you, guys.

And I hope this video is clear.

If you ask me any questions about it, if you have and until next time, I'll see you then.

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