C How to Program (8th Edition)
C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 12, Problem 12.19E
Program Plan Intro

Program plan:

  1. item, root, d variableare used for input. There is structure Treenode havingdata, leftptr, rightptr member variables which represents the tree node.
  2. void insertnode(node **ptr, int value) function inserts the node in the tree and create a tree.
  3. void inorder(node *ptr) function display the tree values in sorting order.
  4. int depth(node *ptr) determine the height of depth of tree and return max depth between left or right nodes path.

Program description:

The main purpose of the program is to create binary search tree, display the tree values and measure and display the depth of the tree.

Blurred answer
Students have asked these similar questions
Computer Science Exercise: depth [★★] Write a function depth : 'a tree -> int that returns the number of nodes in any longest path from the root to a leaf. For example, the depth of an empty tree (simply Leaf) is 0, and the depth of tree t above is 3. Hint: there is a library function max : 'a -> 'a -> 'a that returns the maximum of any two values of the same type. please use Ocaml for the coding
java program binary tree: Given the following binary tree, list all the leaf nodes of this binary tree:
implementation of the Tree function is given below
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education