All language subtitles for 10 - Queues English

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
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
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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:08,350 --> 00:00:12,200 ‫The last video we talked about the stack data structure. 2 00:00:12,290 --> 00:00:18,410 ‫And in this one we're going to talk about the new data structure and one of the important things to 3 00:00:18,410 --> 00:00:24,200 ‫know about both of these types is they're what's called a abstract data type meaning that they really 4 00:00:24,200 --> 00:00:25,730 ‫don't exist. 5 00:00:25,770 --> 00:00:34,190 ‫They're more of a theoretical kind of method for data structures and then they have different implementations 6 00:00:34,250 --> 00:00:36,080 ‫in terms of how you can use them. 7 00:00:36,080 --> 00:00:43,400 ‫So last time we went over arrays and linked lists and were going to do the same thing in this video. 8 00:00:43,430 --> 00:00:48,170 ‫So with queues they're just like stacks are pretty basic. 9 00:00:48,170 --> 00:00:55,280 ‫The important thing to know is that cues are essentially the opposite of a stack in terms of how you 10 00:00:55,280 --> 00:00:58,010 ‫actually pull out the data. 11 00:00:58,010 --> 00:01:01,480 ‫So right here we have our array implementation. 12 00:01:01,550 --> 00:01:06,590 ‫And if we want to add a 5 Element we'll in queue it. 13 00:01:06,620 --> 00:01:10,940 ‫And so that gets put into the zero element. 14 00:01:11,240 --> 00:01:19,790 ‫And now we put a 1 in and you can see this all works essentially the same as a stack where you just 15 00:01:19,790 --> 00:01:24,710 ‫take it and you put these elements inside of the array. 16 00:01:29,040 --> 00:01:34,680 ‫And then just get put two more because we're going to use an example. 17 00:01:34,800 --> 00:01:42,220 ‫And I want to show exactly how that works in a real life type of situation. 18 00:01:42,260 --> 00:01:42,950 ‫OK there we go. 19 00:01:42,950 --> 00:01:49,650 ‫So we have six elements and there are 5 1 2 1 9 and 5. 20 00:01:49,660 --> 00:01:53,180 ‫The values don't matter it's more of just having some things in there. 21 00:01:53,210 --> 00:02:01,580 ‫Now if we want to take an element away if you remember back to our stack example when we popped we actually 22 00:02:01,580 --> 00:02:05,270 ‫popped the last element that we added. 23 00:02:05,270 --> 00:02:10,820 ‫And so that uses a design called The Last In First Out. 24 00:02:10,820 --> 00:02:17,820 ‫So in other words five in a stack if we popped would be the element that was removed. 25 00:02:17,860 --> 00:02:22,920 ‫Q uses the exact opposite methodology with a q. 26 00:02:22,960 --> 00:02:25,610 ‫It is first in first out. 27 00:02:25,610 --> 00:02:27,130 ‫So if I do. 28 00:02:27,230 --> 00:02:30,520 ‫Q I go up to the head. 29 00:02:30,620 --> 00:02:35,260 ‫I pull out that value of 5 and then I leave that as a null. 30 00:02:35,270 --> 00:02:42,570 ‫And so what that means is that this zero element in the array now does not contain anything. 31 00:02:42,590 --> 00:02:47,630 ‫It doesn't move items the items don't shift to the left or anything like that. 32 00:02:47,690 --> 00:02:54,260 ‫If anyone tries to access this element it's just going to give a known value and we can go down the 33 00:02:54,260 --> 00:03:01,390 ‫line and so will go dequeue again pull out the one and again pull out the 22. 34 00:03:01,820 --> 00:03:10,220 ‫And if you notice the array is still 6 values long because no does have a value it has a value. 35 00:03:10,220 --> 00:03:15,170 ‫No it means that there is no value inside of that element. 36 00:03:15,170 --> 00:03:19,990 ‫It's it's a little bit different than if you went to like the sixth or the seventh or eighth. 37 00:03:20,000 --> 00:03:24,040 ‫These elements really don't have anything at all. 38 00:03:24,250 --> 00:03:27,190 ‫But here these ones use two. 39 00:03:27,230 --> 00:03:36,950 ‫So that's very subtle but it is a difference because it shows that we still need to know how long the 40 00:03:37,010 --> 00:03:38,300 ‫array is. 41 00:03:38,300 --> 00:03:43,930 ‫So a really good example because I still find this not the most intuitive way of understanding how a 42 00:03:43,930 --> 00:03:50,080 ‫cue works the way I like to think of it is if you've ever seen one of these. 43 00:03:50,180 --> 00:03:58,250 ‫So does this Spenser's or in grocery stores that are used to hold canned goods quite often. 44 00:03:58,280 --> 00:04:06,410 ‫And the way they work is say you have a number of elements or you have a number of cans you can slide 45 00:04:06,770 --> 00:04:09,200 ‫all of those cans in one at a time. 46 00:04:09,320 --> 00:04:15,170 ‫And so say you add six cans you could slide them in one two three four five six. 47 00:04:15,200 --> 00:04:24,870 ‫The first item the first can that you put in rolls all the way down and it's this item right here. 48 00:04:24,890 --> 00:04:31,190 ‫Now if you want to go access one of these so if you want to get this can a tomato soup right here. 49 00:04:31,250 --> 00:04:36,240 ‫You actually take out the very first item that you pulled up. 50 00:04:36,380 --> 00:04:40,600 ‫So whatever you put in first is the same one that you pulled out. 51 00:04:40,790 --> 00:04:45,290 ‫And if I take another can it's going to be the second item. 52 00:04:45,290 --> 00:04:51,170 ‫It's the same exact way it functions the same way in the array we put in this. 53 00:04:51,200 --> 00:04:52,150 ‫First value. 54 00:04:52,310 --> 00:04:55,960 ‫Then we pulled it out first then this was the second one. 55 00:04:55,970 --> 00:04:59,040 ‫It was a second when we pulled out all the way down the line. 56 00:04:59,090 --> 00:05:00,480 ‫And this is with an array. 57 00:05:00,560 --> 00:05:05,180 ‫It works pretty similar with the linked list in the linked list implementation. 58 00:05:05,270 --> 00:05:19,680 ‫We'll put in a value 43 and now put in 11 and you can see the 43 has a pointer to 11 we also know how 59 00:05:19,680 --> 00:05:25,880 ‫tall it is we know that this is two elements long and the head is 43. 60 00:05:26,070 --> 00:05:35,040 ‫So if I do 51 51 is going to go at the end one will go at the end. 61 00:05:36,270 --> 00:05:38,450 ‫And then three will go at the end. 62 00:05:38,460 --> 00:05:40,540 ‫So here we have a link list. 63 00:05:40,590 --> 00:05:45,540 ‫The head is always going to be pointing at whatever the first item is. 64 00:05:45,660 --> 00:05:51,990 ‫And then this tall call right here this tall points to the last element. 65 00:05:52,080 --> 00:05:56,760 ‫And so we know that this link list has five elements. 66 00:05:56,760 --> 00:06:06,600 ‫Now if we cue it we're going to take this 43 pull it up and out and then we now have the head pointing 67 00:06:06,690 --> 00:06:08,050 ‫at this 11. 68 00:06:08,070 --> 00:06:11,740 ‫Now with the linked list this is represented a lot different than an array. 69 00:06:11,760 --> 00:06:17,700 ‫So it's important to understand how this works and with an array of those index values with the length 70 00:06:17,700 --> 00:06:23,160 ‫list you have pointers to whatever the value is to the right. 71 00:06:23,160 --> 00:06:30,250 ‫So 11 points to 51 51 points to 1 x enter etc. all the way down the line. 72 00:06:30,270 --> 00:06:31,950 ‫So that's how AQ works. 73 00:06:31,950 --> 00:06:36,420 ‫Please let me know if you have any questions whatsoever in the comment section and I'll see in the next 74 00:06:36,420 --> 00:06:37,040 ‫video. 7826

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