00:02
In this question, we have to create a subclass of binary tree that stores the pre -order, post -order and in -order numbers for each node.
00:14
That is a binary tree.
00:19
So we have to create a subclass of this.
00:26
And now in this case, we have to note certain functions that we will be using.
00:35
So we will be using the pre -order number function.
00:39
Then we will be using in -order number function.
00:51
These directions to use these functions or how and why we have to use these functions that is given to us in the question.
01:02
So we'll just use what is given in the question.
01:05
Then post -order numbers.
01:17
These are the methods that are implemented to assign these numbers correctly in a zero n time.
01:25
So let us see how we will create this subclass that is there of binary tree in java.
01:36
So for that, i will use a basic compiler to code and tell you how we proceed.
01:44
So first we have to define a class that is a subclass of the binary tree.
01:53
So for that, we will first introduce and define this subclass.
02:00
So here we can see that t that is there is a generic type representing the data stored in each node.
02:10
So we have to now give three private fields according to what we just decided.
02:18
So these are the three fields that are pre -order, post -order and in -order.
02:24
So these fields keep track of the numbers assigned to nodes in the pre -order, post -order and in -order transversal.
02:32
So in the constructor now, we have to give a super class constructor that is super and it is called to initialize the binary tree that is t part of the numbered binary tree.
02:49
So for that, we will see what we have to put.
02:55
As you can see here, the numbered binary tree has been added, which is a part of the numbered binary tree and the counters that is pre -order count, post -order count and in -order count are set to their initial values.
03:11
So what we have to do next is we have to give a pre -order number method now, which will help us as a private helper method that will assign the pre -order number to each node recursively.
03:27
So for that, we will define this function that is a private helper.
03:36
So as you can see here, it takes node t parameter representing the current node that is being processed...