Question: C language to complete the code of the below question. The incomplete code is below: You are asked to sort a list of floating point

C language to complete the code of the below question.

C language to complete the code of the below question. The incompletecode is below: You are asked to sort a list of floating

The incomplete code is below:

point numbers in descending order. Output the results of heaplification, and theresults of the heap after each delete_max(). Your program should read theinput from the file, and output the answer to another file. Thefirst argument is the input file name, while the second argument is

You are asked to sort a list of floating point numbers in descending order. Output the results of heaplification, and the results of the heap after each delete_max(). Your program should read the input from the file, and output the answer to another file. The first argument is the input file name, while the second argument is the output file name. Name your program as lab7-q3.c. Hint: Reuse the code in question 1. Input file: First line shows an integer n (0 #include #include #include typedef struct node { double key; /* key of a node */ char value[100];/* value of a node */ } Node; /* maximum size of the heap */ /* number of nodes stored in the typedef struct heap{ int maxsize; int count; heap */ Node *data; }MaxHeap; /* storage of the heap */ int main(int argc, char *argv[]){ FILE *fin, *fout; int n, i; MaxHeap *H; Node *S; fin = fopen(argv[1], "r"); fout = fopen(argv[2], "w"); fscanf(fin, "%d", &n); S = malloc(sizeof(Node)*n); /* key is changed to floating point number */ for (i = 0; i data[i].value); fprintf(fout, "%s ", H->data[n].value); /* think about how to generate the remaining output */ // Your code below ... - free(S); maxheap_free(H); fclose(fin); fclose(fout); return 0; }

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!