Differences between revisions 1 and 14 (spanning 13 versions)
Revision 1 as of 2019-07-14 17:11:30
Size: 31
Comment:
Revision 14 as of 2019-07-14 18:09:01
Size: 1766
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
= Assignment 2 = <<TableOfContents>>

= Assignment 2: Word Ladder =

A ''word ladder'' is a sequence of words
 * which are in alphabetic order
 * each word in the sequence differs from its predecessor by
  * changing one letter, e.g. ''born&rarr;barn''
  * adding or removing one letter, e.g. ''band&rarr;brand''

The following are examples of word ladders of different length (that could each easily be made longer):
 * ''big&rarr;bit&rarr;bat&rarr;boat'', length 4
 * ''cold&rarr;cord&rarr;word&rarr;ward&rarr;warm'', length 5
 * ''line&rarr;fine&rarr;five&rarr;dive&rarr;live&rarr;like&rarr;lake&rarr;take&rarr;bake&rarr;cake&rarr;came&rarr;fame'', length 12

{{{
Your assignment is to write a program that computes the longest word chain(s) that can be built from a set of words given on stdin. The output of your program is the maximum length of all the word chains that can be built from the input words, together with all the word chains that have this length.

You should also a complexity analysis (of time) using Big-oh notation.
}}}

The following conditions apply to the input:
 * it may be empty
 * the words are alphabetically ordered, and must be lower case (''a-z'')
 * no word is more than 19 letters
 * there will be no more than 1000 words

Some comments about the programming:
 * There are no restrictions on using arrays.
 * You should use ADTs, in particular stack, queue and graph ADTs, if possible.
 * Call your source program ''ladder.c'' (for submission purposes).
  * In ''ladder.c'' include the statement
  {{{#!cplusplus
  #include "complexity.h"
  }}}
  This header file should contain the complexity analysis as a comment (hence use simple text). Obviously this header file should be submitted as well.

Assignment 2: Word Ladder

A word ladder is a sequence of words

  • which are in alphabetic order
  • each word in the sequence differs from its predecessor by
    • changing one letter, e.g. born→barn

    • adding or removing one letter, e.g. band→brand

The following are examples of word ladders of different length (that could each easily be made longer):

  • big→bit→bat→boat, length 4

  • cold→cord→word→ward→warm, length 5

  • line→fine→five→dive→live→like→lake→take→bake→cake→came→fame, length 12

Your assignment is to write a program that computes the longest word chain(s) that can be built from a set of words given on stdin. The output of your program is the maximum length of all the word chains that can be built from the input words, together with all the word chains that have this length.

You should also a complexity analysis (of time) using Big-oh notation.

The following conditions apply to the input:

  • it may be empty
  • the words are alphabetically ordered, and must be lower case (a-z)

  • no word is more than 19 letters
  • there will be no more than 1000 words

Some comments about the programming:

  • There are no restrictions on using arrays.
  • You should use ADTs, in particular stack, queue and graph ADTs, if possible.
  • Call your source program ladder.c (for submission purposes).

    • In ladder.c include the statement

         1   #include "complexity.h"
         2 
      
      This header file should contain the complexity analysis as a comment (hence use simple text). Obviously this header file should be submitted as well.

Assignment2 (last edited 2019-07-31 22:35:13 by AlbertNymeyer)