Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//System Libraries Here #include //I/O Library using namespace std; //User Libraries Here //Global Constants Only, No Global Variables //Like PI, e, Gravity, or conversions //Function

//System Libraries Here #include //I/O Library using namespace std; //User Libraries Here //Global Constants Only, No Global Variables //Like PI, e, Gravity, or conversions //Function Prototypes Here int mrkRand(int=1<<15-1); //PSRNG repeating the same sequence int *fillAry(int); //Randomly fill a 1-D column array void prntAry(int *,int); //Print a 1-D array void destroy(int **,int *,int *,int);//Deallocate memory int *fillIdx(int); void mrkSort(int *,int *,int); //Use a database sort //Complete the following Function int**fillAry(int *,int); //Randomly fill a triangular array void prntAry(int **,int *,int *,int);//Print a triangular array //Program Execution Begins Here int main(int argc, char** argv) { //Declare all Variables Here int *col; //Pointer to column array int *indx; //Index Array to the Sort Routine int **trangl; //Pointer to triangular array int rowSize; //Number of Rows in the Array //Input or initialize values Here cout<<"Input the Number of Rows in the Array"<>rowSize; indx=fillIdx(rowSize); //Index used for Database Sort col=fillAry(rowSize); //Dynamic 1-D array,#Columns in each row trangl=fillAry(col,rowSize);//Dynamic triangular array //Output Located Here cout<<"The Column Array Size"< Number of rows // col -> Column array size n with number of columns in each row //Output // array -> 2D Triangular Array/Matrix int **fillAry(int *col,int rows){ int **array=new int*[rows]; for(int i=0;i Number of rows // col -> Column array size n with number of columns in each row // array -> 2D Triangular Array/Matrix void prntAry(int **array,int *col,int *indx,int rows){ for(int i=0;iarray[indx[lst]]){ indx[pos]=indx[pos]^indx[lst]; indx[lst]=indx[pos]^indx[lst]; indx[pos]=indx[pos]^indx[lst]; } } } } void destroy(int **a,int *c,int *indx,int n){ //Delete every row of the triangular array for(int i=0;i

-------------------------------------------------------------------------------------------------------------------

use the concepts to generate a random number of columns for each row.

then combine and output the rows from smallest number of columns to largest number of columns.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions

Question

2. How will you handle the situation?

Answered: 1 week ago