CS HW 10 Solution

$30.00 $24.00

In 1881 In Dodge City, Kansas, Bat Masterson fights his last gun battle. And, in 1935 Babe Ruth’s first National League game (Boston Braves), included a homerun. Write a program that uses a pointer-based linked list to manage a spell checker/translator. 1. Your program must read in each line of the input file (hw10data.txt) and…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:
Tags:

Description

5/5 – (2 votes)

In 1881 In Dodge City, Kansas, Bat Masterson fights

his last gun battle. And, in 1935 Babe Ruth’s first

National League game (Boston Braves), included a homerun.

Write a program that uses a pointer-based linked

list to manage a spell checker/translator.

1. Your program must read in each line of the input file

(hw10data.txt) and put each word into a separate link

of a pointer based linked list. 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.

2. You need to create a second word linked list that contains the

“correct” word for each word in the hw10data.txt file. By

“correct,” I mean a word that when it replaces the matching

word in the hw10data.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

(hw10codex.txt) and put each word into a separate link

of a pointer based linked list. 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 hw10data linked list replacing

each word with the translated word from the hw10codex

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 hw10data linked list displaying the

corrected poem. The display MUST have the same exact format

as the hw10data.txt file.

WARNING:

——–

!!!You cannot use **ANY** static arrays!!!

REQUIREMENTS:

————-

1. Your program must run on Linux Mint.

2. Your full name must appear as a comment at the beginning

of your program.

3. Your source code must be named hw10-yourname.c

CS HW 10 Solution
$30.00 $24.00