Question: given an array of lets say 30 items, make a function that prints the highest n values, in this case 10. Do this without sorting,

given an array of lets say 30 items, make a function that prints the highest n values, in this case 10. Do this without sorting, and do it with the fastest algorithm.

int topn = 10;

int array_size = 30;

int a[] = {2, 3, 5, 6, 1, 2, 3, 5, 7, 4, 23, 123, 54, 64, 123, 21, 54, 34, 76, 45, 87, 98, 34, 234, 12, 43, 54, 23, 12, 43};

// function top_n(a, array_size , topn);

In C Language, not C++

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!