Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a PROCEDURAL program that creates a tree for the following string data (stored in an input file sample shown below), where: 1)the leftmost string

Write a PROCEDURAL program that creates a tree for the following string data (stored in an input file sample shown below), where:

1)the leftmost string goes into a node;

2)the middle string goes into the nodes left child; and,

3)the rightmost string goes into the nodes right child.

However, the string null in the middle position means the node has no left child, and the string null in the rightmost position means the node has no right child.

The first line contains the root nodes string in the leftmost position, and for every non-null string, there must be a line with that string in the leftmost position. Use the following data in the input file:

dog over brown

over red jumped

red The quick

The null null

quick null null

jumped fox null

fox null null

brown the lazy

the null null

lazy null null

This data produces the following tree:

image text in transcribed

Note that the string The is not the same as the string the.

It is recommended that you load the tree using preorder searches while reading the input file. After the tree is loaded your program should print out the result of a postorder traversal with a space between each string and a newline at the end.

dog over brown red jumped the lazy The ul

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

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions