If a binary tree has 14 nodes, what is its maximum depth? *
Q: Create a custom exception of unchecked type and write a simple program to display the use of your ...
A: Java Code: class Example { public static void main(String args[]) { int num1=10; int num2=...
Q: 8. Apply the following code segnment on the tree shown in Fig.2. Write its output. void star(struct ...
A: star(A): print(A) star(B): print(B) star(D): ...
Q: Method overriding is used to implement O a. Run-time polymorphism. O b.Interface Oc. Compile-time Po...
A: Method overriding : If subclass (child class) has the same method as declared in the parent class, i...
Q: QUICKSORT(A, p, r) if p < r then q ← PARTITION(A, p, r) QUICKSORT(A, p, q − 1)QUICKSORT(A, q + 1,...
A: From the above algorithm, the flowchart for function quicksort can be drawn as shown below:
Q: Whatever is stored on your computer is accessible from the icon called
A: Icons An icon is a graphical small symbol that helps the user to locate anything or navigate through...
Q: A prime number is any integer that is evenly divisible only by itself and 1. The Sieve ofEratosthene...
A: #include <bits/stdc++.h> using namespace std; // Function to print first N prime numbers void ...
Q: Write a C++ program to display fireworks in a ring shape using asteriks (*). Loops, arrays, function...
A: #include <iostream> #include <ctime> #define ESC char(27) #define FUSEMIN 800 #define FU...
Q: Using C++
A: CODE : #include <bits/stdc++.h>using namespace std; bool checkYear(int year){ return (((year %...
Q: Write a simple C++ code as I am a beginner.
A: ⦁ Created two classes, Base class is a parent class and Derived class is derived from the parent.⦁ C...
Q: Write a C++ program to display fireworks in a ring shape using asteriks (*). Loops, arrays, function...
A: The required c++ code is: #include<iostream>#include<iomanip>#include<stdlib.h>usi...
Q: Create an algorithm which takes a positive integer n as an input then draws a cross on the screen wh...
A: Algorithm : 1. Enter value of n. 2. Create a loop for row from 0 to n*3. Such as i=0 to i<n*3 3....
Q: 1. Find the decimal number represented by the machine number O 01100000101 1110110100010000000000000...
A: Using IEEE 754 floating-point representation, a 64-bit binary floating-point value is expressed as, ...
Q: write with c program
A: #include <stdio.h>#include<string.h>void largest(int arr[],int size);void smallest(int a...
Q: Write a C++ program, which initializes a string variable to the content "Time is a great teacher but...
A: Declare the file stream pointer with the file path. write the string into the file using the pointer...
Q: Write a c program and fill a queue with random numbers between 0 and 100. The size of the queue is a...
A: Queue is a linear data structure where the first element is inserted from one end called REAR and de...
Q: an airline ticket reservation system is to be built for users to directly access the system online t...
A: UML diagram: It stands for unified modeling language .before the actual implementation of software i...
Q: [Very Easy] Given base and n that are both 1 or more, compute recursively (no loops) the value of b...
A: Since multiple questions have been posted at a single request, we will answer first question. If you...
Q: Write a C++ program that reads data from a file containing integers that ends with -999 and Output t...
A: The program is written in C++ #include<iostream> #include<stdlib.h> #include<stdio...
Q: Subject: Introduction to Computer Sciences Write a C++ program to call three functions named;1) Sele...
A: Step 1:- Sorting is used to arrange the data into ascending order. Given:- Make function whose name...
Q: What do you think are the problems that designers and manufacturers may be facing in placing billion...
A: As the size of chip and PCBs are getting smaller day by day and yet the functionalities are increasi...
Q: can you please explain this code which is written to perform these tasks: The list of projects that ...
A: Given: The given code is used to perform tasks by reading a CSV(comma separated values) file from th...
Q: Countries and manufacturers are competing to develop the fastest supercomputer do research on the we...
A: Super computer: this computer features a high level of performance as compared to our normal general...
Q: The data normalization process is one of the pre-processing stages needed to improve model performan...
A: Normalization is used when the the datasets have dat in different ranges. So normalization changes t...
Q: solve the questions 15 and 19 given in the images.
A: Note: - As per the guidelines we can only answer one specific question at a time. Please resubmit th...
Q: Question 2. C++ program to :Write a function to find highest common divisor of two numbers. Pass tw...
A: Recursive function is a function which calls itself We use the same concept here. We call the same f...
Q: Write a program which prompts the user for the number of rooms to be cleaned and the sizes of the ro...
A: Input the number of rooms Input dimensions of each room Find the area of each room If Area is more ...
Q: You are given an array with n elements (all integers). Design an algorithm which prints out True if ...
A: Step 1:- The algorithm is defined as a set of steps that are required to perform a specific task. Th...
Q: Write a program which shouldconsists of a user definedfunction “Newfunction ()”. Pass1D array to the...
A: NOTE : Since programming language is not mentioned therefore answering question in C language #in...
Q: The resultant of A AND B Select one: a. Is always true O b. Is always false except when A and B are ...
A: According to the truth table of A AND B we can say that it is only true when both A and B are True.
Q: In this part your will have questions about C++ functions with pointers. • Write a function that tak...
A: The required C++ code: #include<iostream>#include<iomanip>using namespace std;struct boo...
Q: Which of the following is used as a symbol for off page connection in a flowchart?
A: Flow Chart is a pictorial representation of the flow of program execution and there are multiple sym...
Q: give example on computing timeout interval
A: SOLUTION The word timeout or timeout has many definitions, including: Telecommunications and relate...
Q: Q1: Create a CLR Parsing Table for the given Grammar:A V = EE V | AE E + E | E – E | E * E | E...
A: Grammar: A V = E E V | A E E + E | E – E | E * E | E ^ E | ( E ) | E ? E | ! E
Q: Write a C++ function that will find the cost to send an international fax. The service charge is $7...
A: double calcCost(int n) { double amt = 7; if(n <= 10) { amt += (0.45 * n); } else { amt += ((0....
Step by step
Solved in 3 steps
- Answer the following questions about treeB. a. What is the height of the tree? b. Which nodes are on level 3? c. Which levels have the maximum number of nodes that they could contain? d. What is the maximum height of a binary search tree containing these nodes? Draw such a tree. e. What is the minimum height of a binary search tree containing these nodes? Draw such a tree. f. What is the order in which the nodes are visited by an ignorer traversal? g. What is the order in which the nodes are visited by a preorder traversal? h. What is the order in which the nodes are visited by a postorder traversal?Write a Java program that computes the depth of a binary tree Use the following algorithm to public int depth(Position<E>p) { ](Root(p)) retum 0: 5 else return 1+ depth parent(p));(a) You have an empty binary search tree. After that, you do the following sequence of insertions:20, 30, 10, 50, 40, 60. Draw the status of the binary search tree after the first 3 insertions, and at the endof all 6 insertions (you only need to show 2 trees). (b) Start now with a binary search tree with a single node containing an unknown key X. You mustchoose the value X so that if you later add the 6 keys in question 1(a) in the same order, you get aperfect tree with 7 nodes. Give a value for X and show the final tree obtained.
- Suppose a priority queue is implemented as a binary search tree of integers. Draw the tree resulting froma. enqueuing, in this order, the following integers: 15, 10, 27, 8, 18, 56, 4, 9.b. continuing from part a, three dequeues are invoked.Write Java code to: find the lowest common ancestor of two nodes n1, n2 in a linked binary tree structure. The lowest common ancestor is the lowest node in the tree thathas both n1 and n2 as descendants.Question 9 The number of different binary trees that can be made from 2 nodes that contain the key values 3 and 6 is 2. True False Question 10 Suppose xOrder is one of our binary search tree traversal methods that is passed a tree node, node, and a queue, q. Which traversal order is provided by the following code? xOrder(node.getLeft(), q); xOrder(node.getRight(), q); q.enqueue(node.getInfo()); preorder levelorder inorder postorder None of these is correct.
- Suppose T is a binary tree with 17 nodes. What is the minimum possible depth of T? 1 3 4 2 A binary tree of N nodes has _______. Log2 N levels N / 2 levels Log10 N levels N x 2 levels The difference between a binary tree and a binary search tree is that : in binary search tree nodes are inserted based on the values they contain none of these in binary tree nodes are inserted based on the values they contain a binary search tree has two children per node whereas a binary tree can have none, one, or two children per node What is the best code for the following procedure: AddStudent(studentName):add a new student to an array of alphabetically ordered names . Hint: We must shift some students. size contains the number of students in the array AddStudent(studentName){ int i ; for( i=0; i< size-1; i++){ if(arr[i].compareTo( studentName)>0) break; for(int j= size-1 ; j >i…Insert the following numbers into a binary search tree in the order that they are given and draw the resulting tree. 87; 36; 22; 15; 56; 85; 48; 90; 72; 6 Delete 48 and draw the resulting tree. Delete 15 and draw the resulting tree.Write a Python source code to implement the Depth-First-Search algorithm for thefollowing tree in Figure 2, where 5 is the root node. The output of the source code should be theorder of the nodes visited in the graph. Implement the dfs() function. When a node has two children, visit the left child first then the right child. Use this Template: class TreeNode: def __init__(self, val=0): self.val = val self.left = None self.right = None # Traverse a tree DFS style.def traverse(root): # List that represents visited order. ret = [] def dfs(node): # TODO: Implement DFS algorithm here return dfs(root) return ret def main(): nodes = [None] * 9 for i in range(9): nodes[i] = TreeNode(i+1) # Tree construction # 5 nodes[4].left = nodes[3] nodes[4].right = nodes[5] # 4 nodes[3].left = nodes[1] # 2 nodes[1].left = nodes[0] nodes[1].right = nodes[2] # 6 nodes[5].right = nodes[7] # 8…
- Write a program that inserts the numbers into an initially empty BST such that the treeproduced is equivalent to binary search tree.Insert 15 as a root node then add 1 into 15 to generate 2nd number for insertion, add 2 to the2nd number to generate 3rd number continue adding according to the level of the tree till 5thlevel. Then subtract 1 from root node to generate 7th node Continue subtracting till level of 5thlevelA. The Insert function will only take the root node and construct the entire treeB. Implement a remove function which can remove the 3rd layer numbers from right andleft both sub trees.C. Implement a function to find the number which is nearby to your given age.Draw a binary search tree by inserting the following numbers and determine the predecessor and successor of 10, 1, and 6. numbers to insert {8,1,5,4,9,10,6,3,15}Q2. a. What is a Binary Search Tree? b. Draw the Binary Search Tree that results from the insertion, one at a time, of nodes with Keys 27, 59, 21, 38, 54, 63, 8, 70, 15, 12. (Marking Scheme: Each correct insertion in the tree will give you c. Perform the following operations on the original tree and redraw the tree after each operation ) i.deleting 63 ii.deleting 59 iii.Insert 65 iv.Insert 22 d. Write down the inorder, preorder and postorder traversal on the constructed binary tree.