Program is to find the most frequently used words across all the input files, where each word must appear at least once in each file.
How can this be achieved? I am new to java and yet to dig things deep. So trying through such programs.
Anamika15 0 Newbie Poster
Recommended Answers
Jump to PostWhat do you have so far?
Jump to Postthe algorithm requires reading each file twice
?
Read first file and count words in a master map<word, count>. for every other file: read file & count words in a temp map for each entry in master map: if temp has the same word, add …
Jump to PostSorry, each file content twice.
No, that algorithm is not correct. For example, a word 'blah' found in the first iteration, so it is added. The second file doesn't have it, so it is removed. Then the third file has it, so it is added again. Therefore, it will count …
Jump to PostWhy do you think anything has to be read twice unless you mean to say that reading the hashmap created out of the file is the same as "reading the data twice".
Yes, you could say that too :) It is just less data after the whole data …
Jump to PostAh ok, got your algorithm. Sorry. :)
All 18 Replies
Slavi 94 Master Poster Featured Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
jwenting 1,905 duckman Team Colleague
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Anamika15 0 Newbie Poster

iamthwee
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Taywin 312 Posting Virtuoso
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Taywin 312 Posting Virtuoso
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Taywin 312 Posting Virtuoso
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
Taywin 312 Posting Virtuoso
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Taywin 312 Posting Virtuoso
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.