I'm trying to code a sentence editor. So, basically the input comes form a file, and the code sorts the words. The input in the file is I not do know, theoutput is I do not know.
This is what's gonna be in the input file, but it can be anything:
This is is an an icorrect sntence.
Input Output (on the screen)
delete("is",2)
print 1:This 2:is 3:an 4:an 5:icorrect 6:sntence
delete("an",3)
print 1:This 2:is 3:an 4:icorrect 5:sntence
delete("icorrect",4)
print 1:This 2:is 3:an 4:sntence
insert("incorrect",4)
print 1:This 2:is 3:an 4:incorrect 5:sntence
delete("sntence",5)
insert("sentence",5)
print 1:This 2:is 3:an 4:incorrect 5:sentence
neighbors("is") 2:is previous:This next:an
= This is an incorrect sentence.
The input sentence (possibly a paragraph) is maintained as a doubly linked list. Each node will store a word. The print command send output to the screen. Each word must have its position in the list in format position:word. Words in the list must be separated by one space. And I should assume that there's no maximum number of lines in the input file.
I want to use array based lists/linked lists. Can somebody give me heads up to get started? I already looked at array based lists/linked lists, but it's confusing to me.