Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C++ Develop a simple spell checker and word suggestion program using Hashing . A dictionary of words should be given as a first argument

IN C++

Develop a simple spell checker and word suggestion program using Hashing.

A dictionary of words should be given as a first argument (filename) in the program. This input file is the simple text file "Dictionary.txt", where each line is a word (see Files section).

The program must ask the user to give a word. The program must respond with True if the word exists in the dictionary and with False otherwise. If "True", the program must suggest words (from Dictionary) starting with the same first two letters. At the end of each suggestion the exec. time (in micro-sec) must be displayed (see "TimeInterval.h" in Files section)

Example:

user enters:

$ hi

the program responds:

$ True

hic

him

hip

his

hit

500 micro-sec

TimeInterval.h

#include

#include

/*struct timeval{

long tv_sec; // seconds

long tv_usec; // microseconds

};

*/

class TimeInterval{

public:

timeval start_time;

timeval end_time;

public:

TimeInterval();

void start();

void stop();

float GetInterval();

};

TimeInterval::TimeInterval(){}

void TimeInterval::start()

{

gettimeofday(&this->start_time, NULL);

}

void TimeInterval::stop()

{

gettimeofday(&this->end_time, NULL);

}

float TimeInterval::GetInterval()

{

float t =(float)(end_time.tv_sec-start_time.tv_sec)*1000000.0+(float)(end_time.tv_usec-start_time.tv_usec); // in micro-sec

// t = t / 1000000.0 // in sec

return t;

}

Dictionary.txt

the of and a to in is you that it he was for on are as with his they I at be this have from or one had by words but not what all were we when your can said there use an each which she do how their if will up other about out many then them these so some her would make like him into time has look two more write go see number no way could people my than first water been called who oil sit now find long down day did get come made may part over new sound take only little work know place years live me back give most very after things our just name good sentence man think say great where help through much before line right too means old any same tell boy follow came want show also around form three small set put end does another well large must big even such because turn here why ask went men read need land different home us move try kind hand picture again change off play spell air away animal house point page letter mother answer found study still learn should America world

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_2

Step: 3

blur-text-image_3

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 Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

Develop a self-management module for a training program.

Answered: 1 week ago

Question

Ex2. [10 marks] Use a turtle to draw the below car

Answered: 1 week ago

Question

Determine the amplitude and period of each function.

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago