Giter Site home page Giter Site logo

cpp_wordsearchobjectorientedprogram's Introduction

Word Search and Count

Introduction

This project uses C++, doubly linked lists, and object-oriented design. The program reads the contents of a list of files and stores the words and files in alphabetical order with doubly linked lists. After reading all files, the program outputs the number of unique words found in these files. Then, it asks the user to enter a word. The number of files that this word appears in and the number of time that this word appears in each file gets outputted by the program.

File Descriptions

test_files: Folder containing documents used to test the program.

main.cpp: main program that performs operations and interacts with the user.

bag.h: Specification file for the bag class. Also contains implementations of member and nonmember functions because bag is a template class.

dnode.h: Specification file for the dnode class. Also contains implementations of member and nonmember functions because dnode is a template class.

word.h: Specification file for the Word class.

word.cpp: Implementation file for the Word class.

file.h: Specification file for the file class.

file.h: Implementation file for the file class.

Running Time

  • Searching for a word: O(n)
  • Inserting a word: O(1)
    • However, searching must occur before a word can be inserted

Instructions for Running Code

Compile the program by typing g++ main.cpp word.cpp file.cpp -o main into the terminal. Type ./main test_files into the terminal to run the code. When prompted by the program, type a word into the terminal.

Limitations

Files must only contain letters; the program does not remove grammatical and numerical elements from the words.

Improvements

The running time will decrease to O(logn) if the program uses balanced binary search trees instead of linked lists for storing the data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.