﻿1
00:00:00,390 --> 00:00:05,280
‫So now we're going to do our introduction to depth first search in order.

2
00:00:05,700 --> 00:00:11,430
‫So I'm going to bring up a tree and with depth first search in order, we're going to start at the root

3
00:00:11,430 --> 00:00:17,340
‫and we're going to visit this node and then we're going to go left and visit the 21 node, and we're

4
00:00:17,340 --> 00:00:20,340
‫going to go left again and visit the 18 node.

5
00:00:20,610 --> 00:00:28,710
‫Now, so far, this looks just like depth first search post order, but there is a small change with

6
00:00:28,710 --> 00:00:29,760
‫post order.

7
00:00:29,850 --> 00:00:35,430
‫We looked left and then looked right and then printed out the value of the 18 node.

8
00:00:35,760 --> 00:00:37,110
‫With an order.

9
00:00:37,110 --> 00:00:38,970
‫We're going to look left.

10
00:00:39,180 --> 00:00:42,780
‫We're going to print out the value, so I'm going to colour that in.

11
00:00:43,050 --> 00:00:44,760
‫Then we look right.

12
00:00:45,120 --> 00:00:47,550
‫So now we come back up to the 21 node.

13
00:00:47,550 --> 00:00:48,930
‫It has looked left.

14
00:00:48,930 --> 00:00:54,520
‫Now it's going to print its value and then it goes right to the 27 node.

15
00:00:54,540 --> 00:00:55,560
‫It looks left.

16
00:00:55,560 --> 00:00:57,000
‫It prints this value.

17
00:00:57,000 --> 00:00:59,250
‫It looks right now.

18
00:00:59,250 --> 00:01:02,160
‫We come all the way back up to the 47 node.

19
00:01:02,520 --> 00:01:03,780
‫It has looked left.

20
00:01:03,780 --> 00:01:06,210
‫Now it will print its value.

21
00:01:06,210 --> 00:01:09,150
‫Then go right to the 76 node.

22
00:01:09,360 --> 00:01:12,480
‫The 76 node will go left to the 52.

23
00:01:12,510 --> 00:01:13,590
‫It will look left.

24
00:01:13,590 --> 00:01:16,200
‫It will print its value look right.

25
00:01:16,470 --> 00:01:18,540
‫We come back up to the 76.

26
00:01:18,540 --> 00:01:20,130
‫It already went left.

27
00:01:20,220 --> 00:01:23,790
‫It will print its value and go right.

28
00:01:24,090 --> 00:01:26,310
‫The 82 node will look left.

29
00:01:26,310 --> 00:01:30,180
‫It will print its value and then look right.

30
00:01:30,920 --> 00:01:37,250
‫So I'm going to put the tree back the way it was and just show the order that the numbers are output.

31
00:01:37,490 --> 00:01:40,100
‫They are output in numerical order.

32
00:01:40,100 --> 00:01:49,520
‫We started with the 18 and then did 21, 27, 47, 52, 76 and 82.

33
00:01:50,000 --> 00:01:54,740
‫Hence the name depth for search in order.

