Question: Implement the two algorithms we discussed in class for solving the problem of finding the three/k largest numbers in an input array of integers. The
Implement the two algorithms we discussed in class for solving the problem of finding the three/k largest numbers in an input array of integers. The pseudocode of the two algorithms are given below. (Should be in C++)
int[] findkLargest(int[] a, int k){ n length[a]; if (k<0 or k> n) output Invalid k and return; if (k<=n) return a; int[] largest[0..k1] a[0..k1]; // You may use a loop to do this for(int i=k; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
