Write the following class to solve the/ravelins\' salesman problem. Array -n: in
ID: 3573098 • Letter: W
Question
Write the following class to solve the/ravelins' salesman problem. Array -n: int/number of elements .+ x: i nt: []//che array +Array() +Array(int n_in, int x_in[]) +pop: int//pop the last element from array +push: int []//current (random) path delete(int k): int//delete kth element and return it +insert(int k, int value)//insert value at element k +append(int dim, int more []): void//append morel) to end +getN(): int +copy{int out[]): void//copy x[] to out [] +setRand(int n_in, int min, int max): void +randPerm(int n_in): void +getAve(): float getVariance(): float +sort(): void - swapfint *a, int *b) +getCountInRange(int min, int max): int -tqetValuesInRanqe (int min, int max, int out(])Explanation / Answer
#include <iostream>
using namespace std;
class Array
{
private:
int n;
public:
int x[];
Array()
{
n=0;
}
Array(int n_in,int x_in[]);
int pop();
void push(int[]);
int delete(int k);
void insert(int k,int value);
void append(int dim,int more[]);
int getN();
void copy(int out[]);
void setRand(int n_in,int min,int max);
voidPerm(int n_in);
float getAve();
float getVarience();
void sort();
void swap(int a, int b);
int getCountInRange(int min,int max);
int getValuesInRange(int min,int max,int out[]);
};
int main() {
// your code goes here
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.