All language subtitles for 18 - Red Black Tree Traversal 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,760 --> 00:00:17,050 ‫In this video we're going to review how to find nodes or find node elements in a red black search tree. 2 00:00:17,310 --> 00:00:24,850 ‫And if you're familiar with binary search trees you know how to do this and it's pretty straightforward. 3 00:00:24,870 --> 00:00:30,930 ‫However if you're studying this for the first time it may be helpful in It'll also good to always review 4 00:00:30,930 --> 00:00:31,110 ‫it. 5 00:00:31,110 --> 00:00:39,660 ‫So we have a tree in front of us right here and to find an element we always start with the root node 6 00:00:39,990 --> 00:00:41,910 ‫which in this case is 17. 7 00:00:42,060 --> 00:00:50,130 ‫And then depending on if whatever we're looking for is greater than or less than 17 we will go to the 8 00:00:50,130 --> 00:00:52,940 ‫left or the right hand side. 9 00:00:52,950 --> 00:00:59,890 ‫So if the node we're looking for is the value 23 we'd start at 17. 10 00:00:59,970 --> 00:01:02,120 ‫We know 23 is greater than that. 11 00:01:02,160 --> 00:01:03,900 ‫So we go to the right. 12 00:01:03,990 --> 00:01:05,760 ‫We compare it with 24. 13 00:01:05,790 --> 00:01:08,000 ‫We know it's less than 24. 14 00:01:08,010 --> 00:01:09,190 ‫Go to the left. 15 00:01:09,300 --> 00:01:10,860 ‫We compare it with 22. 16 00:01:10,860 --> 00:01:12,480 ‫We know it's greater than 22. 17 00:01:12,600 --> 00:01:13,710 ‫And then we find it. 18 00:01:13,890 --> 00:01:21,180 ‫So you can see we found it in just one two three hops which is pretty impressive because if we started 19 00:01:21,180 --> 00:01:28,560 ‫in say a sorted array that would have take taking 23 iterations to get to it if you had numbers 1 through 20 00:01:28,560 --> 00:01:29,350 ‫23. 21 00:01:29,370 --> 00:01:36,680 ‫So it's one of the big reasons why binary search trees or red black trees are very important. 22 00:01:37,260 --> 00:01:46,860 ‫And also it's a huge reason why red black trees or rebalancing type of structures like this make searching 23 00:01:46,860 --> 00:01:48,070 ‫much more efficient. 24 00:01:48,120 --> 00:01:52,840 ‫And so we talked in the first video on red black trees. 25 00:01:52,890 --> 00:02:00,180 ‫Whenever you try to find an element you're always going to have a time complexity of order of log in 26 00:02:00,180 --> 00:02:01,710 ‫which is very fast. 27 00:02:01,770 --> 00:02:05,730 ‫So I'm going to go through a few searches here. 28 00:02:05,780 --> 00:02:07,210 ‫A few animated searches. 29 00:02:07,350 --> 00:02:08,670 ‫Just so you can get a hang of it. 30 00:02:08,670 --> 00:02:11,930 ‫So let's search for 21. 31 00:02:12,040 --> 00:02:18,420 ‫It starts at 17 goes to 24 22 and then 21. 32 00:02:18,450 --> 00:02:21,400 ‫You can see it's very very straight forward. 33 00:02:21,480 --> 00:02:26,150 ‫You're just looking at each node comparing it with the value you're searching for. 34 00:02:26,160 --> 00:02:28,310 ‫If it's greater than it you move to the right. 35 00:02:28,320 --> 00:02:35,140 ‫If it's less then you move to the left and we'll go with a couple more and search for 25. 36 00:02:35,190 --> 00:02:36,020 ‫So is that right. 37 00:02:36,030 --> 00:02:38,220 ‫This time it's greater than 24. 38 00:02:38,220 --> 00:02:40,100 ‫Less than 66. 39 00:02:40,170 --> 00:02:41,770 ‫Less than 33. 40 00:02:42,090 --> 00:02:43,120 ‫And there it is. 41 00:02:43,140 --> 00:02:44,010 ‫Found it. 42 00:02:44,160 --> 00:02:49,410 ‫And the last one will look for the smallest node and are the smallest value which is 10. 43 00:02:49,560 --> 00:02:56,230 ‫So it starts at 17 moves to the left moves to the left again and there found it. 44 00:02:56,230 --> 00:03:02,590 ‫Now to actually traverse a tree a black red tree is red black tree. 45 00:03:02,860 --> 00:03:12,940 ‫You can do it pretty easily and I'll show you how that works so I'm going to start this all the way 46 00:03:12,940 --> 00:03:15,120 ‫to the left because we know that's the lowest value. 47 00:03:16,090 --> 00:03:23,890 ‫It goes to its parent which then goes all the way to the left of its child back up to its parent and 48 00:03:23,890 --> 00:03:29,370 ‫then all the way to the right you can see that the way to and then there's your route. 49 00:03:29,410 --> 00:03:36,990 ‫The way to traverse it is simply to look first for the lowest value of every tree structure even some 50 00:03:36,990 --> 00:03:44,260 ‫tree structure and then move your way up to that respective parent and then to the right and then back 51 00:03:44,260 --> 00:03:46,680 ‫again to the greater nodes. 52 00:03:46,680 --> 00:03:49,590 ‫You can see that it's the same exact pattern. 53 00:03:49,600 --> 00:03:54,220 ‫And if we were to have a lot more nodes it would be the same thing which is one of the great reasons 54 00:03:55,060 --> 00:04:03,670 ‫for using recursive type algorithms with trees because they allow for you to scale your approach and 55 00:04:04,540 --> 00:04:07,760 ‫use the same method calls again and again. 56 00:04:07,810 --> 00:04:12,180 ‫And so you can see that's how you traverse a red black tree. 57 00:04:12,190 --> 00:04:19,750 ‫So good job you now have a much better understanding of how red black trees work how you reverse them. 58 00:04:19,750 --> 00:04:24,420 ‫How do insert elements how to delete elements and then how to find them. 5705

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