Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can someone answer h , i, and j only Consider the following tree data structure: a. Use the skeleton C/CH code discussed Moor USA HOME

can someone answer h , i, and j only
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Consider the following tree data structure: a. Use the skeleton C/CH code discussed Moor USA HOME WW Dries Na Dreptos Gracia b. Write the code for visiting the Tree nodes using a preorder traversal algorithm. c. Can you update the preorder traversal function in part b to print the depth of each node visited? d. Write the code for visiting the tree nodes using a post order traversal algorithm. e. Assume that the tree represents a directory system. Add to the structure representing the tree node an integer member representing the number of files in each tree node. Update the tree implementation by reinitializing the tree nodes with a particular number of files as presented in the figure below: Root USR 18 HOME BIN 15 Esans www 7 Projects 15 Graders Man Drives Does 18 Dropbox OneDrive f. Use post order traversal to calculate the total number of files in the directory structure at the root node. Hint: While coding the post order traversal, you should sum the different number of files at the children nodes to come up with the total number of files when reaching the root node. g. Write the code to construct the binary search tree in the figure below: 7 5 14 6 10 16 15 h. Implement the search algorithm for a particular value in the tree. Search for the values 5, 7, 16, and 15. i. Visit the different binary search tree nodes using inorder traversal. j. Write the code to insert a new node into the binary search tree. Insert a couple of new nodes with values you select

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions

Question

In all probability, were likely to have a price increase.

Answered: 1 week ago