Question: C Programming Homework Write a C program project5.c that operates as described below Your program should accept three command line arguments. Argument 1 is the

C Programming Homework

C Programming Homework Write a C program project5.c that operates as described

Write a C program project5.c that operates as described below Your program should accept three command line arguments. Argument 1 is the name of an input file that contains a list of key words. Argument 2 is the name of an input file that contains a list of query words. Argument 3 is the name of an output file First your program reads all the key words in the first input file, and it adds each such key word into a linked list that maintains these key words in alphabetical order. This process ends when the end-of-file condition is reached for the key words. Next your program allocates an array of strings, with size of the array equal to the number of key words in the linked list. Then it copies all the key words from the linked list into this array so that the words remain in alphabetical order Finally your program reads each query word from the second input file, and it uses the binary search algorithm to search for each query word within the array. For each query word that is found to appear in the array of key words, your program prints the word and its index to the output file. This process ends when the end-of-file condition is reached for the query words Here is an example Keywords file red green blue yellow cyan magenta white black gray orange pink Keywords array Queries file indigo white violet black purple yellow brown cyan gold magenta silver gray crimson pink maroon orange scarlet red beige green tan Output file white 9 black 0 0: black 1: blue 2: cyarn 3 gray 4: green 5: magenta 6: orange 7: pink 8: red 9: white yellow cyan 2 magenta 5 gray 3 pink 7 orange 6 red 8 green4 blue 1 10 10: yellow

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!