Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment, you are asked to write a C function with the following signature that spell-checks its first input parameter (which is a

 

In this assignment, you are asked to write a C function with the following signature that spell-checks its first input parameter (which is a string/char array) and returns 0 if it is not spelled correctly: int spell Check(char* word, char* dictionary FileName) {...} To perform spell-checking, you simply need to do binary search on the sorted list of English words given in their correct forms in the file entitled "dictionary.txt" available on Canvas along with the specification of this assignment. The name and path of this file is passed to your function as the second input parameter. Binary search can either be implemented using a binary search tree (taught in the class) or using an iterative algorithm like the following: int binsearch(char* dictionary Words[], int listSize,char* keyword) { int mid, low = 0, high = listSize - 1; while (high > low) { } mid (high+ low) / 2; if (strcmp(dictionary Words[mid],keyword) < 0) low = mid + 1; else if (strcmp(dictionary Words[mid],keyword)>0) high = mid-1; else return mid; } return -1;//not found

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

Step: 3

blur-text-image

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

Management and Cost Accounting

Authors: Colin Drury

8th edition

978-1408041802, 1408041804, 978-1408048566, 1408048566, 978-1408093887

More Books

Students also viewed these Programming questions