FDSA Assignment-4
FDSA Assignment-4
Q.1: Write a spell-checker class that stores a set of words, W, in a hash table and implements a function,
spellCheck(s), which performs a spell check on the string s with respect to the set of words, W. If s is in W,
then the call to spellCheck(s) returns an iterable collection that contains only s, since it is assumed to be
spelled correctly in this case. Otherwise, if s is not in W, then the call to spellCheck(s) returns a list of every
word in W that could be a correct spelling of s. Your program should be able to handle all the common
ways that s might be a misspelling of a word in W, including swapping adjacent characters in a word,
inserting a single character in-between two adjacent characters in a word, deleting a single character from
a word, and replacing a character in a word with another character. For an extra challenge, consider
phonetic substitutions as well.
Q.2 Write a simple text editor, which stores a string of characters using the list ADT, together with a cursor
object that highlights the position of some character in the string (or possibly the position before the first
character). Your editor should support the following operations and redisplay the current text (that is, the
list) after performing any one of them:
• left: Move cursor left one character (or nothing if at the beginning)
• right: Move cursor right one character (or do nothing if at the end)
• delete: Delete the character to the right of the cursor (or do nothing if at the end)
• insert c: Insert the character c just after the cursor
Q.3 Given N words and Q queries. Each query contains a string with a wildcard character. Only one type
of wildcard character is used, which is (*). You need to write a program that prints “Found the Word(s)!”
if the string in the query is found matching with the given N words and print all the available words in
the following line. If no words are found, print “No words Found.”
First, take input N and Q and then N words. Then, take input Q queries and output the corresponding
output for each of them.
Output Format:
Explained above.
Example:
N=6
Q=1
[‘sa*n’]
Output:
saman
Explanation:
The starting and ending of the string match with starting and ending of saman.
Constraints
Please note that the time complexity of the code should be strictly less than Q*N.
Submission Instructions:
You can form your own group of two students. This grouping is allowed only for allowing peer learning.
However, you need to solve yourself all the questions. There will be a demo or viva for these assignments
at a later date. You should submit your exe file, and source files putting all of those into a tar file/ zip file,
and upload it into google class before the submission deadline i.e. midnight, 26th Nov 2022. Your code
should also run on Ubuntu systems (like in the lab) for evaluation purposes. You should also keep a copy
of your code. Any doubts or queries regarding the questions can be emailed to
[email protected].
I/C
(C R Hota)
-----------------------------