The Paper Tree store wants a program that calculates and displays the number of single rolls of wallpaper needed to cover a room. The salesclerk will provide the room’s length, width, and ceiling height, in feet. He or she will also provide the number of square feet a single roll will cover. Desk-check your solution’s algorithm twice, using your own set of data.
Q: 2. Write a program where you can find the n largest number in BST and also print if that node is…
A: Write a program where you can find the n, largest number in BST and also print if that node is leaf…
Q: You have learned an iterative method (using a loop) to find an element inside a Binary Search Tree…
A: Given:
Q: Write a recursive function, leavesCount, that takes a root node (as a pointer) of a binary tree to…
A: As per the Bartleby guideline, I can only solve the first question. Please post the remaining…
Q: my code works the fine the way it is, but I need to add a function for searching for a name and…
A: I have given the required search meathod
Q: b. Write a function which will take a binary tree as input and return the number of total number ef…
A: Ans:) NOTE: As no programming language is mentioned I am using python for the mentioned program.…
Q: 1) If you have a balanced binary search tree with 36 nodes, how many levels will it have? 2) If you…
A: Required: If you have a balanced binary search tree with 36 nodes, how many levels will it have?…
Q: In some environments, such as Genetics, it is not uncommon to have binary trees where the edges…
A: 1.The above structures have a serious flaw due to which providing running code is not possible 2.…
Q: This task is solved in Python. 3. Write a function build_my_graph2 () that: a) creates the following…
A: Here is the python3 code: See below step for code.
Q: The Paper Tree store wants a program that calculates and displays the number of single rolls of…
A: Given :- The Paper Tree store wants a program that calculates and displays the number of single…
Q: Suppose we have the following functions to price bread and ingredients (in cents) fun breadPrice…
A: Stаndаrd ML (SML) is а generаl-рurроse mоdulаr funсtiоnаl рrоgrаmming lаnguаge with…
Q: Write a program that inserts the numbers into an initially empty BST such that the tree produced is…
A: Code Screenshot 1: Code Screenshot 2: Code Screenshot 3: Code Screenshot 4: Code Screenshot 5:
Q: Write a program that inserts the numbers into an initially empty BST such that the tree produced is…
A: Actually, program is a executable software that runs on a computer. Please see step 2
Q: Träd 1 Träd 2 21 21 14 26 14 26 12 15 24 32 12 15 24 32 19 25 19 Trad з 21 Träd 4 21 14 26 14 26 12…
A: A Binary Search Tree is also called as BST.The value of the key of the left sub-tree is less than…
Q: C programming write a code that has ask the user to input how many numbers they are going to input…
A: #include<stdio.h> #include<stdlib.h> typedef struct BST { int data; struct BST *left;…
Q: (a) Write the list of the edges of the spanning tree in the order you add them. (b) Draw the minimal…
A: List of the edges of the spanning tree : Step 01 - Visiting the unvisited adjacent vertex and…
Q: Write a program that inserts the numbers into an initially empty BST such that the tree produced is…
A: import java.util.*;//this is the class for the whole tree that we are going to constructclass BST{…
Q: Write a function which will take a binary tree as input and return the total number of nodes in. the…
A: Here in question asked for only function ,Not the whole code.So I am writing the code no output is…
Q: You are given a Binary Search Tree Program. Uses the Decision Table Test Method to find the Rules,…
A: Below i have answered:
Q: Computer Science Write a simple LISP function to count all leaves in a tree. You need to use a…
A: Question 1. Write a simple LISP function to count all leaves in a tree. You need to use a double…
Q: I need to build a tree with n number of children at each level and t number of levels. Each node…
A: For making a recursive function iterative you can use loop i.e while loop so that iteration can be…
Q: 1. Write a program given two binary trees, A and B, searches Tree B for an occurrence of Tree A by…
A: The answer is in below steps:
Q: You have the following numbers {50,30,20,10,5,60}, on external paper build the binary search tree…
A: Based on the given numbers, after inserting each node one by one BST looks as follows
Q: a. Write a function which will take a binary tree as input and return the total number of nodes in:…
A: As per our guidelines we are supposed to answer only one question. Kindly repost other questions as…
Q: Write a program that inserts the numbers into an initially empty BST such that the tree produced is…
A: Actually, java is a object oriented programming language. It is a planform independent.
Q: Generate pseudocode for a function that will find the minimum value in the tree, in the most…
A: 1. Searching method which is more efficient than linear search is binary search.Time complexity of…
Q: In the search tree below, the two-line codes indicate the target, and the numbers on the edge…
A: a) In BFS Let A be the root node and D is the target. The order of the above graph is A B C D and…
Q: Write a function f1 that takes the root of a binary tree as a parameter and returns the sum of the…
A: /* Program to check children sum property */ #include <bits/stdc++.h> using namespace std;…
Q: wo keys, low and high, and prints all elements X that are in the range specified by low and high.…
A: Your program should run in O(K + log N) average time, where K is the number of keys printed. Thus,…
Q: Write a program that outputs the nodes of a graph in a depth-first traversal.
A: According to BartleBy Guidelines we need to answer only one question So I have answered first…
Q: Given the following letter characters: E, G, B, C, F, A, H, M, K and D, where the value of the…
A: Here our input of letter is: E,G,B,C,F,A,H,M,K and D. a)Preorder traversal from AVL tree:- E ,G ,K…
Q: In which order should you insert items into an initial empty Binary Search Tree to obtain the Binary…
A: Construct BST from each option: A. Insert 10, 20, 15, 12, 16, 18
Q: Write a program that can take a tree as input and traverse it in 3 different formats (pre-order,…
A: Given: Write a program that can take a tree as input and traverse it in 3 different formats…
Q: In the search tree, identify all the solutions
A: As we are three variables x, y and z where X = {2,3,7}, Y = {3,5}, and Z = {7,2}, we have to make…
Q: Write an iterative (non-recursive) function that returns the minimum value in the tree. If the tree…
A: smallestElement() will find out the smallest node in binary tree It checks whether root is null,…
Q: Write a program that inserts the numbers into an initially empty BST such that the tree produced is…
A: Actually, program is a executable software that runs on a computer.
Q: Write a program that inserts the numbers into an initially empty BST such that the tree produced is…
A: BST.java import java.util.*;//this is the class for the whole tree that we are going to…
Q: Using the Huffman tree depicted below, decode the following binary string.
A: the Huffman tree depicted below, decode the following binary string. Answer is given below:--
Q: Write a function maxTree that finds the maximum values within a tree. For example, maxTree t returns…
A: FUNCTION to find maximum element in the tree : void maxTree(Node *root){ //return if no tree…
Q: Use a tree to test whether the following argument is valid or invalid. If it is invalid, read offa…
A:
Q: Write a program to implement the concept of Depth First Search for the string , where A is the…
A: PROGRAM CODE: # Using Python graph = { 'A' : ['B','C','D'], 'B' : ['E','F'], 'C' : ['G'],…
Q: Consider the following, E → E, # T{E.val := E,.val * T.val} E - T{E.val := T.val} T- T, & F{T.val :=…
A: The annotated parse tree for the expression : a # b & c # d & e using the above grammar is…
Q: Question 11 Give a sequence of 8 data items in the order that they are inserted into a binary search…
A: Defined a sequence of 8 data items in the order they are inserted into a binary search tree
Q: A heuristic is a way of trying (a) To discover something or an idea embedded in a program (b) To…
A: Question. A heuristic is a way of trying (a) To discover something or an idea embedded in a program…
Q: 5. A function that takes an avITree and an integer is provided to you. What is the run time…
A: For the given function the time complexity will be O( log n). As we have one while loop gets…
Q: a. Write a function which will take a binary tree as input and return the total number of nodes in…
A: Answer a) we write code in python to calculate total number of nodes:…
Q: Write a Python program to perform alpha-beta pruning of an Alpha Beta Pruning tr
A: Lets see the solution.
Q: a. Write a function which will take a binary tree as input and return the total number of nodes n.…
A: You have asked for multiple questions . Here according to our guidelines I am answering first…
Q: Problem 2. Create an animal guessing binary tree as follows Robin Kangaroo Mouse Trout no yes Are…
A: Given:
The Paper Tree store wants a program that calculates and displays the number of single rolls of wallpaper needed to cover a room. The salesclerk will provide the room’s length, width, and ceiling height, in feet. He or she will also provide the number of square feet a single roll will cover. Desk-check your solution’s
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- Develop a solution that will calculate the average temperature, given a set of temperatures. The number of temperatures may differ from time to time. (Use a trip values to stop the processing of the loop.) Test the solution with the following 10 temperatures. 78 90 85 80 87 83 75 90 86 70Problem 2: Postman Harry Harry is a postman. He's got a post office with a size of n rows and m columns. Each slot at the post office contains a number of letters. Harry can only go right and down. He starts at (0, 0), and ends at (n-1, m-1). Write a program that calculates the maximum amount of letters Harry can pick up. He can only pick up letters from a slot if he is on that slot. If the amount of letters is the same down and right, go right. Sample input/output: Enter the number of rows and columns: 35 Enter the number of letters in the 5 slots of row number 1: 5 2 60 1 Enter the number of letters in the 5 slots of row number 2: 2 4 3 9 2 Enter the number of letters in the 5 slots of row number 3: 8 72 3 4 The maximum number of letters Harry can pick is 32 solve using c++; (chapter 9: Variables / Assignments)Given a square matrix with the elements 0 or 1, write a program tofind a maximum square submatrix whose elements are all 1s. Your programshouldprompt the user to enter the number of rows in the matrix. The program then displaysthe location of the first element in the maximum square submatrix and thenumber of rows in the submatrix. Here is a sample run: Enter the number of rows in the matrix: 5 ↵EnterEnter the matrix row by row:1 0 1 0 1 ↵Enter1 1 1 0 1 ↵Enter1 0 1 1 1 ↵Enter1 0 1 1 1 ↵Enter1 0 1 1 1 ↵EnterThe maximum square submatrix is at (2, 2) with size 3 Your program should implement and use the following method to find the maximumsquare submatrix:public static int[] findLargestBlock(int[][] m)The return value is an array that consists of three values. The first two values arethe row and column indices for the first element in the submatrix, and the thirdvalue is the number of the rows in the submatrix.
- Write a program that picks four cards from a deck of 52 cards and computes their sum. An ace, king, queen, and jack represent 1, 13, 12, and 11, respectively. Your program should display the number of picks that yieldthe sum of 24.While carpet shopping for her living room, Carol Jones noticed that some carpet prices are per square yard, while others are per square foot. Carol wants a program that calculates and displays the area of a floor in both square feet and square yards. She will enter the floor’s measurements in feet. Desk-check your solution’s algorithm twice, using your own set of data.Your team was asked to program a self-driving car that reaches its destination with minimum travel time. Write an algorithm for this car to choose from two possible road trips. You will calculate the travel time of each trip based on the car current speed and the distance to the target destination. Assume that both distances and car speed are given. Don’t copy and paste any other answers.
- Coupon collector is a classic statistic problem with many practical applications. The problem is to pick objects from a set of objects repeatedly and determine how many picks are needed for all the objects to be picked at least once. A variation of the problem is to pick cards from a shuffled deck of 52 cards repeatedly and find out how many picks are needed before you see one of each suit. Assume a picked card is placed back in the deck before picking another. Write a program to simulate the number of picks needed to get four cards from each suit and display the four cards picked (it is possible that a card may be picked twice).Modify program P34_1.cpp to compute the side area, of a cylinder and the area and volume of a sphere, depending on the choice that the user makes. total area, and volume Your program should ask users to enter 1 to choose cylinder or 2 for sphere, and display an "invalid choice error" for other values. For a cylinder, we want to compute: Side area: (2*PI*r) h Total Area: 2*(PI*r2) + Side area Volume: (PI*r2)*h For a sphere, we want to compute: Surface area: 4 *PI*r2 Volume: (4.0/3.0)*PI*r3. Use overloading whenever possible.Need help in python. Problem: 2D random walk. A two dimensional random walk simulates the behavior of a particle moving in a grid of points. At each step, the random walker moves north, south, east, or west with probability 1/4, independently of previous moves. Compose a program that takes a command-line argument n and estimates how long it will take a random walker to hit the boundary of a 2n+1-by-2n+1 square centered at the starting point. //Given codeImport stdioImport randomImport sysn = int(sys.argv[1])//write code herestdio.write('The walker took ')stdio.write(c)stdio.writeln(' steps')
- Write a program that calculates the equivalent resistance of a circuit. n electrical resistors with resistance values R1, R2,.., Rn are said to be connected in parallel if the same voltage is applied across each. Their equivalent resistance Reg is related to the values R1, R2, ..., Rn by: 1 1 1 1 + +...+ R R R, R. "eq Write a program that prompts the user to enter the resistance of n resistors. The user should be prompted continuously by using a while loop until a zero or negative value is entered (the program should count the number of resistors n entered by the user and store the values in an array). Use another separate loop to print the resistance values entered by the user and the equivalent resistance Reg. Test your program with R1= 1 kn, R2= 2 kn, R3= 4 kQ and R4= 8 kQ.Transient PopulationPopulations are affected by the birth and death rate, as well as the number of people who move in and out each year. The birth rate is the percentage increase of the population due to births and the death rate is the percentage decrease of the population due to deaths. Write a program that displays the size of a population for any number of years. The program should ask for the following data: The starting size of a population P The annual birth rate (as a percentage of the population expressed as a fraction in decimal form)B The annual death rate (as a percentage of the population expressed as a fraction in decimal form)D The average annual number of people who have arrived A The average annual number of people who have moved away M The number of years to display nYears Write a function that calculates the size of the population after a year. To calculate the new population after one year, this function should use the formulaN = P + BP - DP + A - Mwhere N is the…The greatest common divisor of two positive integers, A and B, is the largest number that can be evenly divided into both of them. Euclid's algorithm can be used to find the greatest common divisor (GCD) of two positive integers. You can use this algorithm in the following manner: 1. Compute the remainder of dividing the larger number by the smaller number. 2. Replace the larger number with the smaller number and the smaller number with the remainder. 3. Repeat this process until the smaller number is zero. The larger number at this point is the GCD of A and B. Write a program that lets the user enter two integers and then prints each step in the process of using the Euclidean algorithm to find their GCD. An example of the program input and output is shown below: Enter the smaller number: 5 Enter the larger number: 15 The greatest common divisor is 5