Question: Write a program to perform the following in C++ : 1)Implement heapsort and modify heapsort to count the number of comparisons and data exchanges. 2)Sort

Write a program to perform the following in C++:

1)Implement heapsort and modify heapsort to count the number of comparisons and data exchanges.

2)Sort the values from random_order.txtWrite a program to perform the following in C++: 1)Implement heapsort and using the modified heapsort.

random_order.txt 7711,6837,2525,5542,2308,1674,4456,2742,5492,7456,6626,1998,3139,6167,4371,6540,3420,1068,8863,6438,3429,9465,6147,7448,8781,4959,5797,8730,1883,7676,5751,7481,2979,2759,2278,7200,6876,1916,1701,4467,7730,4154,8826,8495,5765,8701,1894,8450,6157,1419,9909,8512,8848,7141,1197,9604,2512,4328,5373,1150,6500,9624,6202,9642,7172,9625,8344,7655,6199,2946,8144,8227,1573,3627,6875,1275,7355,4870,6713,6684,5696,9814,7867,4839,6296,5122,7378,6176,4146,9877,1565,5054,5605,9464,7271,9756,8268,2947,3044,4106,8089,5876,8077,5616,5397,5811,6688,5097,8402,5457,2583,1789,6357,5271,3411,2536,5244,6853,1326,8597,7529,2714,9728,3717,3509,6593,2293,6366,6960,2886,8608,4274,9268,2497,1631,6638,7557,6517,1257,9924,9365,3030,3760,4841,7669,4646,7367,8757,1108,2884,9486,3926,7775,6860,6996,5330,8655,8036,4176,6221

3)Report the number of comparisons and exchanges, and the calculations of n*log2(n) and n2 where n is the size of the list.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!