Maps or Associative Arrays

完了済み 投稿 Aug 3, 2002 着払い
完了済み 着払い

Your assignment is to implement the map abstract data type whose specifications appear below and use it to: implement a rudimentary spelling checker, implement a program that checks anagrams, implement a program that finds words which occur the same number of times in two text files, link your map implementation with our program (top.c) to find the most commonly used words in a file. Specification of Map The specification for the interface to the map module is given to you in the map.h file. You must make and justify all design decisions for your implementation, based on the following important requirements: We will test your map implementation under the assumption that its interface is as described in map.h. Thus, you must not change the interface specification. You must implement the map, test it appropriately, and then report your effort in a test report (see below). Binary Search Trees are not allowed (not that they are bad). You must use some kind of a hash table as it is a very powerful tool for searching. Implement the programs described below. Description of Programs You must use C++. However, no STL is allowed. For C++ programs use extension .cc.

## Deliverables

Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. Complete copyrights to all work purchased. You must submit four files, named map.h, [url removed, login to view], [url removed, login to view], [url removed, login to view], and [url removed, login to view]: map.h Contains the header file that defines the interface for your implementation. Remember, you must not alter our portion of the interface specification, you can only add to the header file those declarations necessary for your implementation. [url removed, login to view] Contains your implementation of the map module. You will probably want to define other routines in here, but they must be declared static so that they cannot be used outside this file. You are free to copy some of the utility routines for manipulating map items that are already provided in our example map.c [url removed, login to view] Contains a main program, and some other functions you may find useful, for implementing a primitive spelling checker. The parameters are as follows: spell [-f dictionary] [file] If no dictionary is given, spell uses ~cfadii/public/words. If no file is given, spell reads from stdin. spell works by creating a map, then adding all the words in the dictionary as indices to the map, using any value (1 is fine). It then reads the file word by word, ignoring punctuation (i.e. it only looks at strings of consecutive alphabetic characters) and checks to see if they are in the map. Warning: the words in the file may not be capitalized properly. Watch for this. You might want to try each potential word as-is, as well as with its first letter changed to lower-case, with all letters changed to lower case, etc. Try to do whatever is reasonable and then document it. [url removed, login to view] Contains the main program, and other functions for finding words that are anagrams of each other. (For example: some of the anagrams of caret are: cater, crate, react, and trace.) Its invocation is: anagram [file] If no file is given, anagram reads from stdin. anagram works by reading the file one word at a time, translating each word into lower-case as it reads. It then stores each word in the map, indexed by its signature. (Here a signature is the letters of the word in alphabetical order. The signature of all the example words above is "acert", while the signature of anagram is "aaagmnr".) Before storing a word, it checks to see if a word with the same signature is already stored in the map. If so, it prints out the word already in the map along with the current word, but does not store the new word. So, if the following words (caret cater crate react trace) are fed into anagram the output produced might look like: % echo caret cater crate react trace > [url removed, login to view] % anagram [url removed, login to view] caret cater caret crate caret react caret trace Check your output for the ~cfadii/public/words file mentioned above. (But do not do it with our implementation of map.c, see below.) [url removed, login to view] Contains a main program, and some other functions you may find useful, which when called as: comm_freq file1 file2 writes to stdin the list of words which occur in both files the same number of times. Each line of output contains an integer followed by alphabetically sorted list of words which occur this many times in both files. The output is sorted by the integer giving the frequency in decreasing order and the words in each line are sorted alphabetically. You must also try map.h and a compiled version of YOUR map.c (in map.o) with our main program in ~cfadii/public/ass2/top.c which contains the main program, and other functions for finding the most used words in a file. Its parameters are: top [-n cnt] [file] where cnt is an integer. If the -n option is not given, then the top 10 words are printed, otherwise the top cnt words are. If no file is given, top reads from stdin. top works by adding each word to a map, with value equal to the old value for this word +1

## Platform

UNIX

## Deadline information

I need the project completed by monday night at around 10:00 pm us and canada mountain time (GMT -7:00)

C プログラミング エンジニアリング Linux MySQL PHP ソフトウェアアーキテクチャ ソフトウェアテスト UNIX

プロジェクトID: #2863739

プロジェクトについて

1個の提案 リモートプロジェクト アクティブ Aug 3, 2002

アワード:

smartpin

See private message.

$38.25 USD 14日以内
(60レビュー)
5.0