Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:07,900 --> 00:00:15,210
‫The last video we talked about the preorder traversal of a binary search tree in this video I'm going
2
00:00:15,210 --> 00:00:22,230
‫to walk through post Storer post order is a lot more complex it's definitely harder to implement from
3
00:00:22,230 --> 00:00:26,390
‫a coding perspective depending on which data structure you use.
4
00:00:26,400 --> 00:00:33,390
‫However once you can get a feel for how it works it shouldn't be a problem especially from a visualization
5
00:00:33,390 --> 00:00:34,150
‫point of view.
6
00:00:34,230 --> 00:00:38,700
‫So if you remember with preorder we start at the root with post order.
7
00:00:38,700 --> 00:00:46,630
‫We actually start using the external nodes first and starting with the leftmost subtree which is then
8
00:00:46,650 --> 00:00:50,610
‫followed by bubbling up all the internal nodes.
9
00:00:50,620 --> 00:00:54,120
‫And so I'm going to show you exactly the way that works.
10
00:00:54,150 --> 00:00:57,920
‫So with this binary search tree we'd actually start.
11
00:00:58,070 --> 00:01:05,670
‫And I'm going to like I did in my last video I'm going to start with putting in the first item in and
12
00:01:05,670 --> 00:01:10,360
‫it's going to be this 0 node right here.
13
00:01:10,410 --> 00:01:17,040
‫So this is where we start because if you remember all the properties of binary search trees the left
14
00:01:17,100 --> 00:01:21,030
‫most value is going to be the lowest value.
15
00:01:21,040 --> 00:01:29,480
‫So with a post order traversal you start with the lowest value and then you go using external modes.
16
00:01:29,490 --> 00:01:34,920
‫So the next one would be two and then four.
17
00:01:34,950 --> 00:01:37,210
‫Now this is where it gets a little bit tricky.
18
00:01:37,470 --> 00:01:43,860
‫Instead of going back up to one which you may think would be the natural thing to do we actually continue
19
00:01:44,020 --> 00:01:45,730
‫just going down the line.
20
00:01:45,750 --> 00:02:01,520
‫And so four would actually go to six and then six would go to five five to three three to one.
21
00:02:01,950 --> 00:02:04,730
‫And you don't go up to the root yet.
22
00:02:04,820 --> 00:02:12,540
‫Next spot that you'd actually go after the one would be the 8 node which is the lowest value on the
23
00:02:12,540 --> 00:02:24,230
‫right subtree you have 8 and four that by a 10 by nine.
24
00:02:25,300 --> 00:02:28,300
‫And the last value is seven.
25
00:02:28,300 --> 00:02:37,380
‫So with this with a post order traversal you're always going to end up on the root node.
26
00:02:37,480 --> 00:02:42,580
‫And so just to give you a little bit of clarity if you want to think of the flow of the way the data
27
00:02:42,580 --> 00:02:46,440
‫works you actually go all the way down.
28
00:02:46,570 --> 00:02:53,980
‫You swoop back up and then you do the same process on the right subtree and obviously this is a lot
29
00:02:53,980 --> 00:02:55,190
‫more complicated.
30
00:02:55,360 --> 00:03:01,540
‫If you were to get to a point where you know you have much further extending binary search trees.
31
00:03:01,570 --> 00:03:04,510
‫These are the basic principles that you can use.
32
00:03:04,510 --> 00:03:09,490
‫And so this is post order traversal please let me know if you have any questions whatsoever and I'll
33
00:03:09,490 --> 00:03:10,530
‫see in the next video.
3613
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.