Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribedimage text in transcribed

The incomplete code is below:

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

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

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

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago