Data Structures with Python: Get familiar with the common Data Structures and Algorithms in Python by Dr. Harsh Bhasin

Data Structures with Python: Get familiar with the common Data Structures and Algorithms in Python by Dr. Harsh Bhasin

Author:Dr. Harsh Bhasin [Bhasin, Dr. Harsh]
Language: eng
Format: epub, pdf
ISBN: 9789355513311
Publisher: BPB Publications
Published: 2023-04-15T00:00:00+00:00


Figure 8.9: The In-order traversal of the left sub-tree

The in-order traversal of the right sub-tree (figure 8.10), shown in figure 8.7, prints the in-order traversal of the left tree ([12, 69, 13]), followed by the data at the root (35 in this case), and then the in-order traversal of the right sub-tree ([14, 78, 15]). The in-order traversal of the right sub-tree, therefore, becomes [12, 69, 13, 35, 14, 78, 15].

Figure 8.10: The in-order traversal of the right sub-tree

The in-order traversal of the tree, therefore, can be returned by getting the in-order traversal of the left tree ([8, 40, 9, 2, 10, 56, 11]), followed by the data at the root (21 in this case), and then the in-order traversal of the right sub-tree ([12, 69, 13, 35, 14, 78, 15]). The in-order traversal of the right sub-tree, therefore, becomes [8, 40, 9, 20, 10, 56, 11, 21, 12, 69, 13, 35, 14, 78, 15] (figure 8.11).



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.