Question: Write two programs to construct a Binary Heap for 5000 random numbers which are between 0 and 50000. These numbers need to be generated
Write two programs to construct a Binary Heap for 5000 random numbers which are between 0 and 50000. These numbers need to be generated by a random function. One program of constructing a Binary heap is inserting the input elements one at a time, into an initially empty binary heap using insert operation. The other program of constructing a Binary heap is using the linear-time algorithm to build a heap using same input. Input: 5000 positive integers generated by a random function ranged between 0 and 50000 and put them into one dimensional array. Output: - Calculated the total number of swapping's. Print out the first 50 elements in the result of each binary heap. Print out the execution time for each program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
