All language subtitles for 23 - Breadth First Search 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,420 --> 00:00:12,570 ‫Find this video we're going to talk about breadth first search. 2 00:00:12,640 --> 00:00:19,980 ‫And one important video to watch before going through this tutorial is to make sure you're familiar 3 00:00:19,980 --> 00:00:21,760 ‫with what a cue is. 4 00:00:21,870 --> 00:00:29,490 ‫And I created a video talking about the difference between a stack and a Q and Q is just an abstract 5 00:00:29,490 --> 00:00:36,030 ‫data structure but it's what gets used with Brett for search so it's a helpful thing to know before 6 00:00:36,030 --> 00:00:38,600 ‫we go in on how this works. 7 00:00:38,910 --> 00:00:45,540 ‫I want to just point out one thing you may hear a lot of people talk about breadth first search and 8 00:00:46,260 --> 00:00:48,840 ‫how that compares with depth first search. 9 00:00:48,840 --> 00:00:54,200 ‫The biggest Kieta know it is breadth first search actually goes one layer at a time. 10 00:00:54,210 --> 00:01:03,360 ‫So if you're searching for an item in using a breath search methodology you're going to go here first 11 00:01:03,990 --> 00:01:09,900 ‫then you're going to go to all these nodes then you're going to go all these nodes and then finally 12 00:01:09,900 --> 00:01:13,460 ‫these lines and you're going to do it one layer at a time. 13 00:01:13,500 --> 00:01:16,510 ‫And I'm going to do that visually here in a second. 14 00:01:16,510 --> 00:01:24,750 ‫So say you want it to go through and see the order that you would find these nodes say these you know 15 00:01:24,780 --> 00:01:29,470 ‫these are all values that we don't know what they are. 16 00:01:29,490 --> 00:01:35,970 ‫So you can see this is not a binary search tree has some resemblances to it but it doesn't actually 17 00:01:36,690 --> 00:01:38,310 ‫it doesn't have the same properties. 18 00:01:38,310 --> 00:01:46,260 ‫This is going to show you how you could use a unstructured tree and see how to go through it and find 19 00:01:46,260 --> 00:01:47,460 ‫the item you're looking for. 20 00:01:47,520 --> 00:01:53,280 ‫So the way that you'd actually go through it is you'd first start at the root node. 21 00:01:53,940 --> 00:01:55,750 ‫And so we're going to give that a 1. 22 00:01:55,810 --> 00:01:58,550 ‫And so one would go into the queue. 23 00:01:58,800 --> 00:02:06,870 ‫After that you'd go to the left side and this would be a two and then you wouldn't keep going down the 24 00:02:06,870 --> 00:02:16,120 ‫left you would go now to all of the items in this level so that 1 2 three four. 25 00:02:16,480 --> 00:02:19,990 ‫And then we just go down to the other level. 26 00:02:19,990 --> 00:02:29,110 ‫So I would go five six seven eight and then we'd finish it off by going to this fourth level. 27 00:02:29,110 --> 00:02:34,830 ‫And so we'd have nine 10 11 and 12. 28 00:02:34,870 --> 00:02:44,770 ‫So the algorithm for breath first search is first you put the root node right here in the queue. 29 00:02:45,190 --> 00:02:48,830 ‫Then you remove a node from the queue and examine it. 30 00:02:48,880 --> 00:02:55,220 ‫So that's the process of going here and then going down to the next one. 31 00:02:55,210 --> 00:03:08,500 ‫And I could draw these arrows going to each node like so and you can see the flow goes like this level 32 00:03:08,740 --> 00:03:09,720 ‫this level. 33 00:03:09,790 --> 00:03:15,820 ‫And then that level and so the what's happening behind the scenes is you're moving a node from the queue 34 00:03:15,820 --> 00:03:17,280 ‫you're examining it. 35 00:03:17,320 --> 00:03:18,610 ‫If the goal element. 36 00:03:18,610 --> 00:03:20,200 ‫So what we're searching for. 37 00:03:20,260 --> 00:03:32,090 ‫So say we're searching you know for five have reset X equal to 5 we would search is five equal to 1. 38 00:03:32,090 --> 00:03:32,780 ‫No it's not. 39 00:03:32,780 --> 00:03:40,730 ‫So then you go down to 2 3 4 and then you finally find your element at 5 but that's the order that you 40 00:03:40,730 --> 00:03:42,390 ‫would search in. 41 00:03:42,500 --> 00:03:49,720 ‫So if it's not you put the successor which is the direct child node that have not been discovered into 42 00:03:49,730 --> 00:03:57,080 ‫the queue which is all that means is that you'd take whatever element and then go down to the next one. 43 00:03:57,140 --> 00:04:01,070 ‫If the element you are inspected is not the one that you're looking for. 44 00:04:01,340 --> 00:04:04,080 ‫If the queue is empty every node has been examined. 45 00:04:04,130 --> 00:04:07,980 ‫So that would be if we get down to 12. 46 00:04:08,240 --> 00:04:17,930 ‫And so if that's the case and we haven't found our item that means that the search returned a null value 47 00:04:17,930 --> 00:04:22,400 ‫which means the item was not included in the data structure. 48 00:04:22,460 --> 00:04:30,140 ‫And so if the queue is not empty then you would just keep on going so the queue is not going to be empty 49 00:04:30,470 --> 00:04:33,470 ‫until you get to this very last value. 50 00:04:33,470 --> 00:04:40,700 ‫So if you may wonder if you're like me why you'd ever use breath first search because that was my very 51 00:04:40,700 --> 00:04:48,410 ‫first thought because binary search trees are you know much more useful and there are also at least 52 00:04:48,410 --> 00:04:50,550 ‫to me a lot easier to understand. 53 00:04:50,600 --> 00:04:58,610 ‫And so what was explained to me is if you're building something like a artificial intelligence agent 54 00:04:58,760 --> 00:05:07,010 ‫and you say for example you want to build an agent that knows how to play chess in order to teach it 55 00:05:07,010 --> 00:05:15,770 ‫how to play chess you would actually give it a series of moves and then you would have the agent or 56 00:05:15,770 --> 00:05:23,870 ‫your artificial intelligent robot or a piece of software be able to make adjustments based off of those 57 00:05:23,870 --> 00:05:27,300 ‫moves in a good way of doing it is using breath for a search. 58 00:05:27,320 --> 00:05:36,320 ‫So say for example that the very first move that was made on the chess board was to this three value 59 00:05:36,590 --> 00:05:37,750 ‫right here. 60 00:05:37,760 --> 00:05:46,040 ‫If that was the case then you would be able to ignore the rest of all these items and you'd be able 61 00:05:46,040 --> 00:05:54,140 ‫to then just go down the line and say OK the only moves that matter from this point on are the ones 62 00:05:54,140 --> 00:05:57,140 ‫that are descended from this 3 node. 63 00:05:57,140 --> 00:06:01,710 ‫So the breadth first search isn't the best. 64 00:06:01,730 --> 00:06:08,360 ‫The best thing to use in every case however there are some cases where it actually is the most efficient 65 00:06:08,360 --> 00:06:15,350 ‫by far especially if you're doing things with having to do with artificial intelligence or you're doing 66 00:06:15,350 --> 00:06:25,220 ‫things that have a pre-determined set of steps so that you know that at each level there is a certain 67 00:06:25,220 --> 00:06:30,320 ‫item that it can be selected and that's going to be the most efficient way of doing it. 68 00:06:30,320 --> 00:06:36,410 ‫So that's a brief explanation of breath first search and the next video we're going to go over depth 69 00:06:36,410 --> 00:06:40,650 ‫first search and how that can be utilized in algorithm development. 7811

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