Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C, write a program that uses a pointer-based linked list to manage a spell checker/translator. ------------------------------------------------------------- 1. Your program must read in each word

In C, write a program that uses a pointer-based linked list to manage a spell checker/translator.  ------------------------------------------------------------- 1. Your program must read in each word of the input file (hw8data.txt) and put each word into a separate link in a linked list (you *MUST* create a pointer-based linked list for this). For each word, you need to create a link that can hold that word precisely (i.e. the payload section must be sized specifically for each word). In other words, your structure for the linked list *CANNOT* look like this: struct node { char word[n]; struct node *next; } It *MUST* look like this: struct node { char *word; struct node *next; } The difference is that in the required form, there is no space allocated for the text. You will have to use malloc/calloc to allocate that space. However, you can use a static array of length 42 to read the words from the file. ------------------------------------------------------------- 2. You need to create a second word linked list that contains the correct word for each word in the hw8data.txt file. By correct, I mean a word that when it replaces the matching word in the hw8data.txt file the poem makes sense. We will call this the codex file. 3. Your program must read in each word of the codex file (hw8codex.txt) and put each word into a separate link in the linked list (you *MUST* create a pointer-based linked list for this). For each word, you need to create a link that can hold that word precisely (i.e. the payload section must be sized specifically for each word). In other words, the same rules apply for this linked list as in the first linked-list. Your structure for the linked list *MUST* look like this: struct codex { char *word1; char *word2; struct codex *next; } At this point you MUST have 2 linked lists. 4. You must traverse the hw8data linked list replacing each word with the translated word from the hw8codex linked list. In some cases the existing word will be removed (e.g. "plane" "lee" may become "plainly" so "lee" must be removed from the linked list). In other cases the codex word may be longer or shorter than the original word, in these cases the original link must be deleted and replaced with a new link. This guarantees that the memory consumption will be optimal/minimal. You can do this with every replaced word if you like. You **CANNOT** simply create a third linked list, you are only allowed to have 2 linked lists, in total. 5. You must traverse the hw8data linked list displaying the corrected poem. The display MUST have the same exact format as the hw8data.txt file. This means you will have to keep track of puncuation marks and line feeds. WARNING: -------- !!!You cannot use **ANY** static arrays!!! ------------------------------------------------------------- 6. Create seperate functions that insert into the two linked lists (LIST_INSERT_POEM() and LIST_INSERT_CODEX()). Create a function that corrects that poem (LIST_CORRECT()). Create a function to display/traverse the corrected poem (LIST_DISPLAY()). Create seperate functions that free the two linked lists (LIST_FREE_POEM() and LIST_FREE_CODEX()). 

hw8data.txt file contains following text:

Eye have a spelling chequer, It came with my Pea Sea. It plane lee marks four my revue, Miss Steaks I can knot sea. Eye strike the quays and type a whirred, And weight four it two say, Weather eye am write oar wrong, It tells me straight aweigh. Eye ran this poem threw it, Your shore real glad two no. Its vary polished in its weigh. My chequer tolled me sew. A chequer is a bless thing, It freeze yew lodes of thyme. It helps me right all stiles of righting, And aides me when eye rime. Each frays come posed up on my screen, Eye trussed too bee a joule. The chequer pours over every word, Two cheque sum spelling rule.

hw8data.txt contains following text:

Eye I eye I chequer checker Pea P Sea C plane plainly lee skip four for revue review Miss Mistakes Steaks skip knot not sea see quays keys whirred word weight wait Two To two to Weather Whether write right oar or aweigh away threw through Your You're shore sure two to no know Its It's vary very weigh way tolled told sew so bless blessed freeze frees yew you lodes loads thyme time right write stiles styles righting writing aides aids rime rhyme frays phrase come composed posed skip trussed trusted too to bee be joule jewel cheque check sum some 

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 Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago