By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,903 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,903 IT Pros & Developers. It's quick & easy.

need help.....want to know whats the logic...not the code

P: 3
There are 2 files (A.txt,b.txt)
A.txt has 4 columns seperated by tabs
B.txt has only one column

My job is to find multi-word tags (i.e. tags that are more than one word) in A.txt, if a tag matches a tag in B.txt, print the tag ) from the file A.txt

i know i need to use hashes but cannot understand how.....can smeone explain
Feb 23 '10 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 2.5K+
P: 3,503
Would it be possible for you to supply sample data? I would definitely like to see what the "multi word tags" look like. By that, I mean are they multi-word but contain underscores or are they multi word, space separated.

A sample would help greatly.

Also, is this in any way related to school work?


Feb 23 '10 #2

P: 3
sample A.txt is
7 12 photograph 1000
8 12 black and white 1000
9 12 president 1029
176 55 pink togas 507
177 55 renaissance 507
178 55 use of perspective 507
179 55 four guys in corner 507
180 55 four guys in corner 507
277 66 pier 455
278 66 harbor 455
279 66 windy 455
280 66 nineteenth-century 455
372 89 direct 842
373 89 light-on-eyelashes 842

Yes this is a school home work,I'll really appreciate it if you can explain me the logic.......
Feb 24 '10 #3

Expert 100+
P: 2,057
So the tags are in the third column in A.txt?

You need to find or create a hash function. Then store your strings in a hashtable, where the key is the hash of the string, the string is the object.

If you create a table from A.txt, then for each string in B.txt, hash it, and search on that hash value.
Feb 24 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.