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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alron
    New Member
    • Feb 2010
    • 3

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

    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
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    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?

    Regards,

    Jeff

    Comment

    • alron
      New Member
      • Feb 2010
      • 3

      #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.......

      Comment

      • jkmyoung
        Recognized Expert Top Contributor
        • Mar 2006
        • 2057

        #4
        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.

        Comment

        Working...