Question
Below is a function to create a random numbers using an array. int * xcreateRandomDynaArray(int n) { int *dynaArray; //to create diffreent random numbers srand(time(NULL));
Below is a function to create a random numbers using an array.
int * xcreateRandomDynaArray(int n)
{
int *dynaArray;
//to create diffreent random numbers
srand(time(NULL));
//allocate space for dynamic array
dynaArray = (int *)calloc(n, sizeof(int) );
int i=0;
//the for loop to fill teh array
for (i = 0; i < n; i++ )
//add a random integer between 0-10000
*(dynaArray + i) = rand() % 10000;
return dynaArray;
}
Create a function to make a heap by inserting the numbers created from above function. After create a function which removes the data that is the root and insert it at the last position. Display the resulting array.
Please use C programmin language
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started