Question: Given Files: selection.h #ifndef SELECTION_H #define SELECTION_H #include int select(size_t k, const int* list, size_t N); #endif // SELECTION_H selection.cpp #include #include selection.h int select(size_t

 Given Files: selection.h #ifndef SELECTION_H #define SELECTION_H #include int select(size_t k,

const int* list, size_t N); #endif // SELECTION_H selection.cpp #include #include "selection.h"

Given Files:

selection.h

#ifndef SELECTION_H

#define SELECTION_H

#include

int select(size_t k, const int* list, size_t N);

#endif // SELECTION_H

selection.cpp

#include

#include "selection.h"

int select(size_t k, const int* list, size_t N) {

// TODO(student): solve the selection problem

}

Task 1 Write a program to determine (select) the k-th largest value in a list of N values. Requirements Files selection.cpp selection.h selection_tests.cpp Makefile Function int select(size_t k, const int* list, size_t N); Input X Low systm resources may affect your audio quality. Try N closing some applications to improve performance. to select the number of values in the list, N > 0 Output The value which is the k-th largest in the list. Exceptions Throws std::invalid_argument if the arguments are invalid, e.g. kis out of bounds. Approved Includes cstddef, iostream, stdexcept, selection.h Tests You must submit a test suite that, when run, covers at least 90% of your code. Example Consider the list A [8, 6, 7, 5, 3, 0, 9]. select(2, A, 7) returns 8 Low system resources may affect your audio closing some applications to improve perf 6 7 5 3 select(4, A, 7) returns select(3, A, 7) returns select(5, A, 7) returns select(6, A, 7) returns select(7, A, 7) returns select(1, A, 7) returns select(0, A, 7) throws select(8, A, 7) throws O 9 std::invalid_argument std::invalid_argument

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!