C How to Program (8th Edition)
C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 12, Problem 12.23E
Program Plan Intro

Program plan:

  1. Item, root variablesare used for input. There is structure Treenode havingdata, leftptr, rightptrmember variables which represents the tree node. Structure qitem having treenode, nextPtrvariables which represents the queue and stores the Treenodetype value.
  2. voidinsertnode(node **ptr, int value) function inserts the node in the tree and create a tree.
  3. voidinorder(node *ptr) function displays the tree values in sorting order.
  4. voidpreorder (node *ptr) function displays the tree values in pre order fashion.
  5. voidpostorder(node *ptr) function displays the tree values in post order.
  6. voidlevelorder(node *ptr) function display the tree values in sorting order.
  7. voidenque(queue **front, queue **taiil, node *tnode) function stores the Treenodetype data in a queue.
  8. node*deque(queue **front, queue **tail) function delete the Treenode type from the queue and return the Treenode type value.

Program description:

The main purpose of the program is to create binary search tree and display the tree value using levelorder algorithm. It then compares the output of this algorithm with the preoder, inorder and postorder output.

Blurred answer
Students have asked these similar questions
Given the following infix expression: (28 * (33 - 3) + 10) / (4 * 0.5) % 4 Give the equivalent postfix expression Draw the tree corresponding to the recursive calls to evaluate the postfix expression. What is the depth of your tree?
C++, Write a recursion function that counts the positive elements multiple of 5 in a binary search tree and counts the elements less than 0 and multiple of 2, then returns the two counts multiplied to the main.Note that you have to write only one function and you can add parameters to the function as needed
1. Do some research about binary search trees.   2. Create a structure in C for the nodes of this tree. Which variables do the structure have?   3. Write a function that builds a balanced binary search tree. The input argument of this function is a sorted array of integers.   4. Write a recursive function that inserts a new element to the tree. The input argument of this function is a pointer to the head node of the tree.   5. What is the time complexity of this insertion function?
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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