
Need answer for part 2
In Data Structures, you studied binary heaps. Binary heaps support the insert and extractMin
functions in O(lgn), and getMin in O(1). Moreover, you can build a heap of n elements in
just O(n). Refresh your knowledge of heaps from chapter no. 6 of your algorithms text book.
Now implement Merge Sort, Heap Sort, and Quick Sort in C++ and perform the following
experiment:
1. Generate an Array A of 107 random numbers. Make its copies B and C. Sort A using
Merge Sort, B using Heap Sort, and C using Quick Sort.
2. During the sorting process, count the total number of comparisons between array ele-
ments made by each
function to compare numbers, which increments a count variable each time it is called.

Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

- USING C++, Implement a TEMPLATED Binary Search Tree (RECURSIVE) class, that is minimal & complete. Provide the following recursive operations: Insert, Delete tree, Search, inOrder traversal, preOrder traversal, postOrder traversal. Methods essential for correct operation of tree in terms of managing memory must be provided. Any additional methods can be added. Use function pointers in the traversal routines. cannot use std::function (or any other similar routine from std namespace. Test BST to make sure all methods work. In particular make sure that you can pass the tree to other routines by value, const reference and reference. Check that data values are as expected on pass/return to/from routines. Do not use GUI interaction. Input/Output (user): Sample output formats shown below use made up data for the year 1905. Menu options are: The average wind speed and sample standard deviation for this wind speed given a specified month and year. (print on screen only) Eg: January…arrow_forwardI need help with this pratice run question. In C++, Implement a Hash Table of size 8191 (= 2^13 - 1) to store integers based on quadratic probing. Design your own hash function that is, in your view, sufficiently non-trivial and efficient to compute. Compare the average number of probes for the following cases:Generate 4000 integer random numbers in the range 0 to 10^6 - 1, and insert them into the hash table. Compute and print the total number of probes.Repeat step (a) above 10 times, and find the average number of probes over these 10 trialsarrow_forwardPlease help me with this Principles of programming language homework questionarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





