All language subtitles for 26. Exercise 7 - Print Max Appearances LowerCase Letter in File - Solution

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

OK, so now let's solve it together and basically proceed with the previous solution that we had for

the previous exercise.

Let's open it up.

Take a look at what it has, make some adjustments and hopefully this will work just fine.

So previously we've created file name array of characters, read the file name from the user, opened

these file and basically read all the information created the frequency array that was used to represent

the total amount, the total appearances, the total occurrences of each lowercase letter, how many

time, how many times it appeared in the file itself.

And then after this line, we know that frequency array holds values that we present the number of times

that a certain character and associated character appears in a file.

Now what we need to do is ask the following question at what?

What is the actual character that appears most of the time?

OK, so that's why we will need probably to find the maximum.

So for that, let's create this part.

OK, let's create a max index equals to zero.

So Max index equals to zero will represent the actual index inside a frequency array where the element

has the maximum of appearances.

OK.

So if, for example, we know that lowercase C has the maximum of appearances of, let's say, 10 times,

then Max Index will basically be two because we know that frequency array at index still represents

the total amount of appearances for lowercase C.

OK.

You feel me so far.

Awesome.

So inside in this loop will start this loop from one, right, because we assume that.

The maximum will be at the first index at index zero.

And we will ask the following question if.

Frequency array.

Frequency array at the MAX index so far.

If the total appearances in the Maxine decks so far in the frequency array is last, then the Frequency

Array Index, i.e. in the current index that we are taking a look at.

Then what we will need to do.

What do you think that's the main part?

Maxine Index will be equal to I.

OK.

So every time we will go element by element and ask if the element of this specific index, i.e. if

the value inside of Lisa is greater than the value inside of this array of index Maxine Biggs then update

max index.

That's it.

And the final thing that we need to do is to say, printf, let's see, say, the maximum appearances.

Are of a lower case.

Ease of character, let's say, percentage, see.

Percentage, see, OK.

That's what we do.

And instead of percentage C, we can specify what.

We can specify Max Index plus lower case A.

OK, that's how we get the actual on the actual lowercase letter.

So let's see how it works.

Let's see what will be the answer.

So answer a file name.

What was it?

My file that sixty four so the number the maximum appearances of a lowercase is of character.

Oh, OK.

Let's see.

How many times did it appear?

OK, so let's see.

We want the number of appearances, the number of its appearances, its years is.

And here he is presented and here specify that we need to access frequency.

Array at Index Max Index.

OK, now we are going to see how many times the lower case, oh, in this case was inside of our function,

so let's go like this.

So my file ducked.

So it appeared five times.

Let's make sure of it.

OK, let's make sure of it.

Open folder in File Explorer my file that you see.

So I remember that the lowercase a was four times.

Let's see how many times we have.

Oh, so one, two, three, four and five.

Yeah, probably.

Oh, appears most of the time in this file?

OK, so this is it, guys.

That's how you work with it.

That's how we found.

How many times.

And which of the characters appeared most of the times in our.

Not not the characters, but the lowercase letter, as they appeared most of the time in the file itself.

Of course, we can extend it in support also for uppercase or basically for all of the characters that

we can use in some range, for example.

But that's not for this video, for this video, that should be just enough.

And thank you guys for watching.

Keep on practicing and let's proceed.

OK, you ready?

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