• 3 days ago
Transcript
00:00Now, the next important concept which we talk about in trees is our levels and our sub-tree.
00:06Levels means that our data, we already know that hierarchy is stored.
00:11So, the first level that the data is stored, we say that it is stored on level 1.
00:16If you are watching a video or course or school or college about trees,
00:22then some people start the concept from zero level.
00:25We start the first level where we are called zero level.
00:29That's right.
00:31Here we go with level 1 terminology.
00:352 and 3 are our level 2.
00:384, 5, 6 are our level 3.
00:427, 8, 9 are our level 4.
00:46This is our depth concept.
00:50Depth is our ghera.
00:52Level 1 is our depth.
00:55Level 2 पर जितनी भी nodes है उनकी depth है.
00:572, level 3 की nodes की depth है 3.
01:00Level 4 की nodes की depth है 4.
01:02तो यहां पर अगर हम देखना चाहें कि 7 की क्या level है और क्या depth है.
01:07तो इस node 7 का level है 1, 2, 3 & 4.
01:13तो इसका level है 4 और इसकी depth है 4.
01:16अब level और depth से एक और concept निकला वो है concept subtrees का.
01:21हर node का अपना एक subtree होता है.
01:23जैसे इस 3 की बात करें.
01:25तो इसका कोई left child नहीं है पर इसके right में बहुत सारे nodes हैं.
01:29तो 3 का कोई left subtree नहीं है पर 3 का एक right subtree है जिसके अंदर 6 & 9
01:35दोनों आ जाते हैं.
01:36उसी तरीके से अगर 2 के लिए analyze करें.
01:39तो यह जो सारी nodes हैं यह 2 के left में आती है और यह node 2 के right में
01:43आती है.
01:44तो 2 के अंदर 2 का left subtree है उसके अंदर 4, 7, 8 आते हैं और 2 के right
01:50subtree के अंदर सिर 5 आता है.
02:16अगर हम leaf node की बात करें तो leaf node भी अपने आपमे एक subtree बना सकता है.
02:22which is the sub-tree which is null.
02:25So these are some concepts which we should keep in mind when we talk about trees.