A program that counts the number of nodes in a binary tree

Assignment Help Computer Engineering
Reference no: EM132208395

Question :

Write a program in c that counts the number of nodes in a binary tree, count the nodes in the right sub-tree, and count the nodes in the left sub-tree.

Ask the user to enter their name and grade for the midterm exam. Find out if the tree is unbalanced or balanced. You're building the tree based on the results of the midterm. The root node for the binary tree is 90.

Use this equation to find if the tree is balanced.

abs(# of nodes in left subtree - # of nodes in right sub-tree) <= 1

Use this as an example of a tree not being balanced.

gary 90

michael 100

jerry 88

steven 0

shauratt 99

Kris 60

Mary 99

larry 71

tarik 88

joey 100

Output: This binary tree is not balanced.

Reference no: EM132208395

Questions Cloud

Calculate the after tax present worth : Your company wants to build a new manufacturing facility which will cost $2.5 million for plant and machinery. It will have a net annual income cash flow.
Calculate 8-bit binary value for each value : Read the user file and Generate Correspondingly ASCII value of each character in file. Calculate 8-bit binary value for each value.
Write a program that will simulate process scheduling : Write a program in C or Java that will simulate process scheduling. From the command line you take in the input file name as one of the arguments.
Calculate the square footage for a house : Write a program in C that calculates the square footage for a house. The very first thing your program should do is to print your full name using a printf().
A program that counts the number of nodes in a binary tree : Write a program in c that counts the number of nodes in a binary tree, count the nodes in the right sub-tree, and count the nodes in the left sub-tree.
Will the price charged by the noncolluder be affected : Use the dominant firm model to graphically show how the colluders will behave if the sixth firm will not participate and instead acts competitively.
Declare a structure to store the code number : Write a program in C++ that declares a structure to store the code number, salary and grade of an employee.
Define an array with a maximum of 20 integer values : Define an array with a maximum of 20 integer values, and fill the array with numbers input from the keyboard or assigned by the program.
Describe the process of managing a network security : Design WAN infrastructures and Implement WAN infrastructures - Identify one monitoring tool and explain in detail how the National Park Service

Reviews

Write a Review

Computer Engineering Questions & Answers

  What is the least data transfer rate across the bus

What is the least data transfer rate across the bus

  Evaluate emerging trends in the certification

Certification is the evaluation of the security controls of an IT system to establish the extent to which a particular design and implementation meets.

  Write a c program for a shopping list

Write a C program for a shopping list. Use the listed items and add one additional item to the list.

  Write a c language program to accomplish conversion

Repeat Example and write a C program using A/D converter's interrupt bit indicating completion of conversion. Use addresses, and other parameters.

  How input from an html5 form is retrieved in a php program

Describe how input from an HTML5 form is retrieved in a PHP program.

  Examine the editor available on unix and personal computer

Examine the editor available on Unix and personal computer & Does it have batch-oriented commands?

  Compute the dollar amount of money in a piggy bank

Write down a detailed set of instructions, in English, to calculate the dollar amount of money in a piggy bank that contains h half-dollars, q quarters, n nickels, d dimes and p pennies.

  Design a program that let the user enter the total

SDEV 140 : Design a program that let the user enter the total rainfall for each of 12 months into an array.

  You have been recently hired to help with purchasing

you have been recently hired to assist with purchasing computer forensics tools and resources for a major corporation.

  What is a pending interrupt

Why, in most processors with interrupts. are further interrupts disabled when the processor reaches the interrupt service routine?

  The advantages and disadvantages of using functions

Show how you might write the "case" statement using only the "if" statement in its place an actual case statement. Hint: Nested if statements. Explain your code.

  Write a boolean function name is prime that takes an integer

Write a Boolean function named Is Prime that takes an integer as an argument and returns true if the argument is a prime number or false otherwise.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd