1. Assume we build a binary max-on-top heap from keys 10, 12, 1, 14, 6, 5, 8, 15, 3, 9, 7, 4, 11, 13, 2.        a. Show the result of building this heap by inserting the above keys one at a time in the order given (from left to right), into an initially empty binary heap. Please show key steps and short illustrations if necessary.        b. Show the heap from problem (a) above after executing three deleteMaximum operations on this heap. Show each step. 2. Use the same key set given Q1, write a program to output the median using heap structure. The median is the value separating the higher half from the lower half of a data sample. For example, the median of input is 8. 3. Use the same input stream of Q1, implement HeapSort in ascending order.

Question
1. Assume we build a binary max-on-top heap from keys 10, 12, 1, 14, 6, 5, 8, 15, 3, 9, 7, 4, 11, 13, 2.
       a. Show the result of building this heap by inserting the above keys one at a time in the order given (from left to right), into an initially empty binary heap. Please show key steps and short illustrations if necessary.
       b. Show the heap from problem (a) above after executing three deleteMaximum operations on this heap. Show each step.
2. Use the same key set given Q1, write a program to output the median using heap structure. The median is the value separating the higher half from the lower half of a data sample. For example, the median of input is 8.
3. Use the same input stream of Q1, implement HeapSort in ascending order.

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Engineering

Data Structures

Related Computer Engineering Q&A

Find answers to questions asked by students like you.

Q: A laser beam 1 mm wide is aimed at a detector 1 mm wide 100 m away on the roof of a building. How mu...

A: Formula for determining the angular diversion of laser before it misses the detector is given below-

Q: Hello! Write a C++ Program that simulates a basic calculator using functions which performs the oper...

A: Solution:Given data,The C++ code to perform the calculator operations using function is given below:...

Q: 1. What is the output of the following code? public class Loopy {public static void main(String[] ar...

A: 1.Explanation for the given java code:In the class "Loopy", variable "x" is declared and initialized...

Q: Write a program called HeadsOrTails, that lets the user guess whether the flip of a coinresults in h...

A: The following variables used:coin to hold the value of random flipcoinString to hold the text value ...

Q: What is system change-over

A: System changeover is a process of changing the way a thing is done to another and how other activiti...

Q: Hello, I am struggling to write a program in Python for a following problem: Write a file ( .py). In...

A: Solution:Given data,The python code to strips the first letters from all file names in a directory i...

Q: Write the Circle class:• A Circle has a radius– Add instance variable– 2 constructors – one should b...

A: Create a class Circle and define it's instance variable as private type and just declare default con...

Q: Based on Program.Py below, develop a list of requirements that could have been used to create the or...

A: Requirements are statements or items that shall be used or that a system needs while writing a progr...

Q: Based on Program.Py below, define and describe a soft process (using a process model), which you wil...

A: Solution:Process model:The software process contains the four activities such as software specificat...

Q: • Create a Scanner (note which line the user inputs and presses enter)• Asks the user to enter the n...

A: The algorithm for the program would be as below:Prompt the user for the inputAccept the user inputCo...

Q: Assume that a firm has already implemented a KMS system, as a manager, how do you ensure that learni...

A: The given case study describes the internal knowledge assets of the organization and details about t...

Q: Im using python and i need to 1)Fill the function definitions 2) Fill in the missing code in main() ...

A: Program Instructions:Use math.pi to calculate the area and circumference of the circle.Use ‘“{:,.2f}...

Q: What is the output of the following code? !doctype html> Find the output ax3 + b2 - c abc ...

A: HTML math tag is used to insert MathML elements inside a webpage. With in <msup> tag those cha...

Q: Give two example computer applications for which connection-oriented service is appropriate. Give tw...

A: Two example computer applications for which connection-oriented service is appropriate:-Connection-o...

Q: What is the CPU time if the number of instructions executed by the program is 500 cycles per instruc...

A: CPU time:The formula for computing the CPU time is provided below:

Q: Write a program in Eclipse called LoopMinMax that reads in 4 values from the user and prints the low...

A: Algorithm: The program has the following algorithm:The class name is “LoopMinMax” and in the main me...

Q: What values will print? Use Eclipse to verify it • Only write the answerdouble x = Math.sqrt(4);Syst...

A: Solutions://Define the classpublic class Example{     //Define the main() method     public static v...

Q: Imagine you’d like a contractor to build a software application for you that operates like Windows C...

A: Since there are multiple questions and no specification as to which question needs to be solved, her...

Q: When a mobile host is not at home, packets sent to its home LAN are intercepted by its home agent on...

A: Care of address.when Mobile host is not at home, it gets a temporary IP address. This IP address is ...

Q: It's Java so here's the question Write the code to calculate the total of three int variables a, b, ...

A: To write a program in java, to calculate the sum of given three integer variables and printing their...

Q: Consider the client A sends the data of 12 bytes to the sender B using the UDP. What is the efficien...

A: Efficiency:In User Datagram Protocol (UDP), the formula for computing efficiency of the transmission...

Q: What is the output of the following code? def test_func (*a) print (a[0]) test_func1,2,3,4) test fun...

A: Consider the given code:#Function definition test_func()def test_func(*a):    #Print the output    p...

Q: Operations on B-Trees: a. Construct a B-Tree by using 4, 2, 3, 9, 7, 8, 6, 11, 12, 1 having the orde...

A: Construction of a B Tree involves certain steps and few rules. Here a B tree is to be constructed of...

Q: Using Java Eclipse IDE do the following program. Programming exercise similar to 9.1, Change Rectang...

A: Programming instructions: First, create a class “Square” and then declare two variables width and co...

Q: In a special case of a permutation cipher, we take a message, M, and write its letters in an s× t ta...

A: Given, message M= ATTA CKAT DAWNsecret key S= (3,4)Encryption:arrange the message in table form(3x4)...

Q: Subclass toString should call include super.toString(); re-submit these codes.   public class Vehicl...

A: Program Modifications:Add the super.toString() call with the other print statements in the toString(...

Q: Which partitioning method must be used for partitioning a 4-TB hard drive?

A: Partitioning 4-TB Hard drive:Hard drive uses two methods for partitioning the drive; they are, Maste...

Q: How do I write a code that places my name in an email link? Thanks

A: As there is no particular programming language mentioned, we are doing this using HTML code.

Q: Consider the three words A, b and c in the network .the host transmits the packet of size 700 bits t...

A: Transmission delay is the time required to upload packets within a network for transmission.Propagat...

Q: How would i solve this question? I have the sample output but how do I make it? Write a program in p...

A: Program Instructions:Create a menu using print() function and use while loop to repeatedly show the ...

Q: a. Assuming that x is 1, show the result of the following Boolean expressions.(true) && (3 &...

A: a. The result for the following Boolean expressions:Assuming x = 1(true) && (3 > 4)3 is n...

Q: Consider the UDP header 12 03 00 OF 00 1E A3 10. What is the total length of the UDP? a) 32 bytes b)...

A: Consider the given:The given User Datagram Protocol header is “12 03 00 0F 00 1E A3 10”.

Q: how do I Write a String constant consisting of exactly 5 exclamation marks. in python language

A: String Constants: The string constant is nothing but the sequences of characters that is used as dat...

Q: I need help with this problem I attatched the sample output Exempt You will be writing a program to ...

A: Program plan:Display the welcome statementGet the average value from the user and check the average ...

Q: see attached

A: The SQL query used to create a database ‘e_store’ then creating a table ‘products’ also to insert va...

Q: Are all nonfunctional requirements equally important?  Why or why not?

A: Justification:“Yes”, All non functional requirements are equally important.

Q: rewrite the function F = (A ⊕ B) ⊕ C without the XOR operator, ⊕.

A: The XOR operator is defined as 1 ⊕ 1 = 0, 1 ⊕ 0 = 1, 0 ⊕ 1 = 1, and 0 ⊕ 0 = 0. As the output is true...

Q: The following print code is to find out the ASCII code, character for the decimal codes,and comparis...

A: Reasons for displaying given output for each line of code: For “System.out.println((int)'1');”: From...

Q: I need  crow ERD Model with PK, FK and Referential integrity Arrow Electronics is a consumer electro...

A: The 8 entities are indicated below with only their unqiue identifier (underlined) and one or more ot...

Q: A sequential circuit has an input (X) and two outputs (S and V). X represents a 4-bit binary number ...

A: Solution:The following code is described about the behavioral Verilog description for given state gr...

Q: What is the reduced form of the function F X(XY)+X(X+Y)? a) Y b) X c) 0 d) 1

A: Reduction:The reduced form of the function “F” is computed as follows:

Q: Imagine you’d like a contractor to build a software application for you that operates like Windows C...

A: Statement of objectives (SOO):It provides an overall objective which serves as the basis for the sta...

Q: Using Java Eclipse do the following program: Design a class named Rectangle to represent a rectangle...

A: Program Instructions:Declare variables width and height.Create a default and parameterized construct...

Q: this question is from fundamentals of logic. related to boolean algebra. I am unable to decipher the...

A: Click to see the answer

Q: Show the output of the following code: Explain brieflyint a = 6;int b = a++;System.out.println(a);Sy...

A: The Output of the given code is shown below along with the code. To run the given code, it is import...

Q: this is a problem that I have how would I go about solving it? Stadium Seating There are three seati...

A: Algorithm: Include required header files.Define main function.Initializes the seat prices for class ...

Q: How Technology can help to develop more effective policy?  (Information technology in Global Economy...

A: Information technology:Information technology(IT) has become a very important part of every business...

Q: Assignment (Math application):Write a program that prompts the user to enter a 3 x 3 matrix of doubl...

A: NOTE: The programming language is missing in the question. The following program is written in Java ...

Q: As SOA service vendors are likely to be consolidated over time, an IT utility will emerge. In that s...

A: Success factors:The success factors of service enterprises depending on IT utility are as follows:Bu...

Q: Which of the following statements are true? In PC relative addressing mode, the PC and constant need...

A: In PC relative addressing mode, the effective or branch address is obtained by adding offset to PC t...