The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 407 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
1. Give an O(n)-time algorithm for computing the depth of all the nodes of a tree T, where n is the number of nodes of T.
2. The indented parenthetic representation of a tree T is a variation of the parenthetic representation of T (see Figure 7.7) that uses indentation and line breaks as illustrated in Figure 7.23. Give an algorithm that prints this representation of a tree.

Figure 7.7:Â Parenthetic representation of the tree of Figure 7.2. Indentation, line
breaks, and spaces have been added for clarity.
Electronics R’Us (
R&D
Sales (
Domestic
International (
Canada
S.America
Overseas ( Africa Europe Asia Australia ) ) )
Purchasing
Manufacturing ( TV CD Tuner ) )
Figure 7.2: A tree with 17 nodes representing the organizational structure of a fictitiouscorporation. Electronics R’Us is stored at the root. The children of the rootstore R&D, Sales, Purchasing, and Manufacturing. The internal nodes store Sales,International, Overseas, Electronics R’Us, and Manufacturing.

Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- -----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------sol-----------uti-----------on.-----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- ca-----------tch-----------