Results 1 to 10 of 10

Thread: Algorithm to merge files

Threaded View

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Question Algorithm to merge files

    Hi

    I would like build some algorithm to join records of the textfile when the difference between two records is is less than 2

    characteristics of records

    1) The size is always 14 characters
    2) The possible characters are: (1,2,3,4,5,6,7)
    3) Usually has only the characters: 1.2 and / or 4

    Should I read the file in sequential order, and find for each record all possible records that have difference of 1 or two characters
    example of records
    [pre]
    42444442414411
    42444441414211
    42444441214411
    42444421414411
    42424441414411
    42244441414411
    41444442424411
    41444442414421
    41444442414412

    [/pre]
    When found some record less than 2 minimum difference, should add up the numbers that are different and eliminate one of the records
    Example :
    42444442414411 and 42444441414211

    The two records merge into:42444443414611


    As this record has already been summed, it is discarded in the next comparisons

    What Is the best way to do It reading a text file ?
    Last edited by mutley; Mar 27th, 2015 at 01:11 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width