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

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,730 --> 00:00:06,580 OK, so now let's solve it together and basically proceed with the previous solution that we had for 2 00:00:06,580 --> 00:00:07,630 the previous exercise. 3 00:00:07,960 --> 00:00:08,960 Let's open it up. 4 00:00:08,970 --> 00:00:13,930 Take a look at what it has, make some adjustments and hopefully this will work just fine. 5 00:00:15,840 --> 00:00:21,270 So previously we've created file name array of characters, read the file name from the user, opened 6 00:00:21,270 --> 00:00:29,040 these file and basically read all the information created the frequency array that was used to represent 7 00:00:29,040 --> 00:00:36,210 the total amount, the total appearances, the total occurrences of each lowercase letter, how many 8 00:00:36,210 --> 00:00:40,100 time, how many times it appeared in the file itself. 9 00:00:41,090 --> 00:00:48,770 And then after this line, we know that frequency array holds values that we present the number of times 10 00:00:48,770 --> 00:00:52,400 that a certain character and associated character appears in a file. 11 00:00:53,210 --> 00:00:57,260 Now what we need to do is ask the following question at what? 12 00:00:57,650 --> 00:01:01,550 What is the actual character that appears most of the time? 13 00:01:02,150 --> 00:01:06,200 OK, so that's why we will need probably to find the maximum. 14 00:01:07,220 --> 00:01:08,920 So for that, let's create this part. 15 00:01:08,930 --> 00:01:15,230 OK, let's create a max index equals to zero. 16 00:01:15,770 --> 00:01:24,950 So Max index equals to zero will represent the actual index inside a frequency array where the element 17 00:01:25,910 --> 00:01:28,640 has the maximum of appearances. 18 00:01:29,450 --> 00:01:29,870 OK. 19 00:01:30,200 --> 00:01:36,770 So if, for example, we know that lowercase C has the maximum of appearances of, let's say, 10 times, 20 00:01:37,160 --> 00:01:44,240 then Max Index will basically be two because we know that frequency array at index still represents 21 00:01:44,780 --> 00:01:48,410 the total amount of appearances for lowercase C. 22 00:01:49,010 --> 00:01:49,220 OK. 23 00:01:49,250 --> 00:01:50,120 You feel me so far. 24 00:01:50,960 --> 00:01:51,380 Awesome. 25 00:01:52,460 --> 00:01:58,850 So inside in this loop will start this loop from one, right, because we assume that. 26 00:01:59,940 --> 00:02:03,330 The maximum will be at the first index at index zero. 27 00:02:03,720 --> 00:02:05,850 And we will ask the following question if. 28 00:02:07,230 --> 00:02:08,460 Frequency array. 29 00:02:09,730 --> 00:02:12,640 Frequency array at the MAX index so far. 30 00:02:14,410 --> 00:02:21,190 If the total appearances in the Maxine decks so far in the frequency array is last, then the Frequency 31 00:02:21,190 --> 00:02:26,080 Array Index, i.e. in the current index that we are taking a look at. 32 00:02:27,060 --> 00:02:28,440 Then what we will need to do. 33 00:02:28,620 --> 00:02:30,660 What do you think that's the main part? 34 00:02:30,960 --> 00:02:34,200 Maxine Index will be equal to I. 35 00:02:35,570 --> 00:02:36,010 OK. 36 00:02:36,290 --> 00:02:44,090 So every time we will go element by element and ask if the element of this specific index, i.e. if 37 00:02:44,090 --> 00:02:51,050 the value inside of Lisa is greater than the value inside of this array of index Maxine Biggs then update 38 00:02:51,050 --> 00:02:51,680 max index. 39 00:02:51,920 --> 00:02:52,460 That's it. 40 00:02:53,530 --> 00:03:01,750 And the final thing that we need to do is to say, printf, let's see, say, the maximum appearances. 41 00:03:03,420 --> 00:03:05,940 Are of a lower case. 42 00:03:07,430 --> 00:03:11,690 Ease of character, let's say, percentage, see. 43 00:03:13,350 --> 00:03:15,460 Percentage, see, OK. 44 00:03:16,530 --> 00:03:17,700 That's what we do. 45 00:03:18,620 --> 00:03:22,130 And instead of percentage C, we can specify what. 46 00:03:23,100 --> 00:03:27,510 We can specify Max Index plus lower case A. 47 00:03:28,550 --> 00:03:34,830 OK, that's how we get the actual on the actual lowercase letter. 48 00:03:34,910 --> 00:03:36,150 So let's see how it works. 49 00:03:36,170 --> 00:03:37,730 Let's see what will be the answer. 50 00:03:38,240 --> 00:03:39,870 So answer a file name. 51 00:03:39,890 --> 00:03:40,550 What was it? 52 00:03:40,580 --> 00:03:48,440 My file that sixty four so the number the maximum appearances of a lowercase is of character. 53 00:03:48,470 --> 00:03:50,080 Oh, OK. 54 00:03:50,150 --> 00:03:50,960 Let's see. 55 00:03:51,380 --> 00:03:52,890 How many times did it appear? 56 00:03:52,910 --> 00:03:54,260 OK, so let's see. 57 00:03:54,560 --> 00:04:02,570 We want the number of appearances, the number of its appearances, its years is. 58 00:04:04,070 --> 00:04:08,840 And here he is presented and here specify that we need to access frequency. 59 00:04:09,750 --> 00:04:13,350 Array at Index Max Index. 60 00:04:14,400 --> 00:04:21,330 OK, now we are going to see how many times the lower case, oh, in this case was inside of our function, 61 00:04:21,340 --> 00:04:22,590 so let's go like this. 62 00:04:22,980 --> 00:04:24,680 So my file ducked. 63 00:04:25,890 --> 00:04:27,810 So it appeared five times. 64 00:04:27,930 --> 00:04:29,040 Let's make sure of it. 65 00:04:29,280 --> 00:04:30,780 OK, let's make sure of it. 66 00:04:31,110 --> 00:04:34,260 Open folder in File Explorer my file that you see. 67 00:04:34,260 --> 00:04:37,670 So I remember that the lowercase a was four times. 68 00:04:37,800 --> 00:04:39,400 Let's see how many times we have. 69 00:04:39,480 --> 00:04:45,750 Oh, so one, two, three, four and five. 70 00:04:45,750 --> 00:04:47,040 Yeah, probably. 71 00:04:47,040 --> 00:04:50,820 Oh, appears most of the time in this file? 72 00:04:51,630 --> 00:04:53,390 OK, so this is it, guys. 73 00:04:53,400 --> 00:04:54,620 That's how you work with it. 74 00:04:54,630 --> 00:04:55,560 That's how we found. 75 00:04:56,590 --> 00:04:57,520 How many times. 76 00:04:57,640 --> 00:05:02,110 And which of the characters appeared most of the times in our. 77 00:05:03,990 --> 00:05:09,150 Not not the characters, but the lowercase letter, as they appeared most of the time in the file itself. 78 00:05:09,630 --> 00:05:15,900 Of course, we can extend it in support also for uppercase or basically for all of the characters that 79 00:05:15,900 --> 00:05:18,360 we can use in some range, for example. 80 00:05:18,690 --> 00:05:22,350 But that's not for this video, for this video, that should be just enough. 81 00:05:23,040 --> 00:05:24,480 And thank you guys for watching. 82 00:05:24,510 --> 00:05:26,730 Keep on practicing and let's proceed. 83 00:05:27,490 --> 00:05:28,970 OK, you ready? 7160

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