Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. a. Using C/C++, define the tree node structure (e.g. value is an integer, left and right are a node type pointer) and build a

image text in transcribed
1. a. Using C/C++, define the tree node structure (e.g. value is an integer, left and right are a node type pointer) and build a binary search tree by giving 10 random numbers, b. Define three functions: inOrder). preOrder), and postOrder) to output the node values of the tree in three different orders. Finally, design a recursive function freeTreeNodes0 to free all memory of the binary tree. c. Based on 1a & 1b, define a function which search it a given number is in the tree. 2. a. While building a binary search tree (BST), if the numbers come in the following sequence: 8, 7, 9, 20, 11, 10, 12. 13, 5. 1; what will be the tree like after constructed? How many comparisons are made totally? b. Given the following binary tree, write the InOrder. PreOrder, PostOder traversals. c. Given a binary tree with 8 nodes, if its InOrder and Postorder traversal results are: InOrder Postorder 1 2345678 32147685 Reconstruct the tree according to the results; is this tree a binary search tree

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

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago