00:00Now let's talk about the build tree.
00:02How can we build our tree?
00:04Here we have a sequence given here.
00:07We call this sequence pre-order sequence.
00:10The pre-order sequence actually
00:11how to calculate it.
00:14That's what we will learn in the next topic.
00:16Here we will learn how to create a pre-order sequence.
00:20In this sequence, we have all our nodes data given here.
00:24Here it means that this node is null.
00:28The pre-order sequence, the tree is a simple way.
00:32First, you have your node data given.
00:35Then, you have the left subtree data given.
00:38Then, you have the right subtree data given.
00:41This is the whole process.
00:43We will do recursively.
00:44What are we going to do?
00:45We are going to 1-1 to nodes.
00:47First, we are going to 1-1.
00:48We have created a node that we have added to 1.
00:52After 1, we will create 1-1 to the left subtree.
00:55We are going to 1-1.
01:00Then, we will create 2-2 to the left subtree.
01:02We have then, we will enter 4.
01:04We have now created 4-4 to the left subtree.
01:07Thus, the should we create .
01:08Then, we have 1-1 to the left subtree.
01:11I will show This between 4 as a true node.
01:15After this means, we will create the path特別 to the left subtree.
01:16This comes, therefore, the left subtree and right subtree just women,
01:19we created some
01:19Line subtree, we will give it 1-1,
01:23and put it 1-2-1.
01:23So, we will create a curve 2 artist if we have.
01:25अब एक level उपर जाएंगे
01:26यानि 4 से 2 पर आ जाएंगे
01:282 का right subtree बनाने निकले
01:30तो हम आ गए 5 पर
01:31यहाँ पर एक और node लगाना है
01:33जिसमें 5 को store करा दिया
01:35अब 5 का left subtree बनाना है
01:375 के left subtree के लिए हम जाएंगे
01:39minus 1 पर तो यहाँ पर null आ गया
01:543 को हमने यहाँ पर add कर दिया
01:56अब 3 का left subtree बनाना है
01:58उसके लिए 1 आ गया है तो minus 1 आया
02:00यानि यहाँ पर आएगा null
02:02उसके बाद 3 का right subtree बनाना है
02:04तो उसके लिए हम एक आ गया है
02:06यहाँ पर है value 6 तो 6 को यहाँ पर add कर दिया
02:09अब 6 का left subtree बनाना है
02:116 left subtree
02:12के लिए
02:121 index आगे गए
02:13minus 1
02:14यानि null
02:14अब right subtree
02:15बनाना है
02:16तो यहाँ पर भी
02:171 index आगे गए
02:18यानि null पर आगे
02:19तो index सारे के सारे
02:21एक एक करके
02:21आगे आगे बढ़ते रहना है
02:23पहले node बनानी है
02:24फिर उसका left subtree
02:26बनाना है
02:26फिर उसका right subtree
02:27बनाना है
02:41और यहाँ पर 6
02:42और जो बाकी के
02:42नल वाले nodes हैं
02:44उनको हम usually
02:45ट्री में नहीं दिखाते हैं