HW5_hash_table.pdf - COSC 2320 Data Structures Homework 5...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COSC 2320: Data Structures Homework 5: Hash Tables Deadline: Nov. 22, 2014 1. INTRODUCTION In this homework you are asked to create a C++ program that acts as a primitive search engine, first searching for keywords in a series of files, storing those keywords in a hash table (indexing) and implementing a quick way of determining what files contain certain keywords (searching). 1.1 Keywords To find the keywords in a text document you will first need to load the file into a linked list in the memory, as was done in previous homework. From this list you should delete words that cannot be keyword s such as “a”, “the”, “is”, etc. This list of non -keywords, commonly called stop words , will be provided for you in a special file. The remaining words will be the keywords in your file. This can be added to a common repository in memory. 1.2 Indexing You will need to create a special data structure to hold your results. This structure should have a field for a single keyword, which will act as the index, and a list of the files where this keyword is present. For instance if the word “blue” can be found only in text files “rainbow.txt” and ”colors.txt”, your data structure might look like: {keyword=‘blue’, files = {‘rainbow.txt’, ‘colors.txt’}} This data structure should be stored in a hash table and you should allow for more files to be added to the structure. In essence after you process the words in a file (as in 1.1) you will search your hash table for each keyword. If the word is found, then you should add the file to the list. If it is a new keyword, you should add it to the hash table.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern