Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 525969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:43:38+00:00 2026-05-13T08:43:38+00:00

I am looking for an algorithm, hint or any source code that can solve

  • 0

I am looking for an algorithm, hint or any source code that can solve my following problem.

I have a folder it contains many text files. I read them and store all text in STRING. Now I want to to calculate, if any of the word appeared in other files or no. ( I know its not clear let me give an example)

For example i have two documents:
Doc A => “brown fox jump”
Doc B => “dog not jump”
Doc C = > “fox jump dog”

Lets say my program read the first document and now first word is “brown” now my program will check if this word is also appeared in any other document? So the answer would be 0. Now it will check again for 2nd word “fox”, it will give output that yes it appeared in (Doc C) so on……
Now it will read Doc B and it will check if dog appeared in other document? Answer would be (Doc C) so on….

Any advice or pseudo code?

Hint: It is also called inverse document frequency ( Idf ). I know what is idf.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:43:39+00:00Added an answer on May 13, 2026 at 8:43 am

    Like GregS said, use HashMap. I’m not posting any code, because I think this is a homework and I want to give to you the opportunity to create it on your own, but the outline is:

    1. Open new document
    2. For every word, look at your hashmap if it’s already there. If it isn’t, create a new key in HashMap with this word, and in that position add the new document (the filename). If it is, just add the filename of the document.

    For example, if you have:
    DocA: Brown fox jump
    DocB: Fox jump dog

    You would open DocA and traverse its contents. ‘brown’ is not in your hashmap, so you would add a new element with key ‘brown’ and value ‘DocA’. The same with ‘fox’ and ‘jump’.
    Then you would open DocB. ‘fox’ is already in your hashmap, so you would add to its value DocB, (the value would be ‘DocA DocB’). Maybe using an ArrayList (in Java) would help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for any algorithm or source code which can find whole or partial
I'm looking for an algorithm that can check if nested regex repeats are reducible.
I have the same problem as : Can SHA-1 algorithm be computed on a
We're looking for an algorithm to solve this problem in under O(N). given two
I am looking for an algorithm that given a photo / image, it can
I am looking at an algorithm that can map between characters with diacritics (
I'm looking for an algorithm that will evenly distribute 1 to many items into
I'm looking for an algorithm to solve the following in a reasonable amount of
I am looking for an algorithm that will allow me to visually separate any
I am looking for a algorithm that takes a string and splits it into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.