Results 1 to 6 of 6

Thread: VB Dataset Sorting Problem

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2001
    Posts
    22

    VB Dataset Sorting Problem

    I have a set of data that needs to be sorted.

    It is comprised of six numbers per line (a pair of triplet data sets), there may be more than 500 lines

    The data comes in a form where the lines are all jumbled up like this:

    A(8),B(8)C(8),A(9),B(9),C(9)
    A(5),B(5)C(5),A(6),B(6),C(6)
    A(1),B(1)C(1),A(2),B(2),C(2)
    A(2),B(2)C(2),A(3),B(3),C(3)
    A(4),B(4)C(4),A(5),B(5),C(5)
    A(3),B(3)C(3),A(4),B(4),C(4)
    A(6),B(6)C(6),A(7),B(7),C(7)
    A(7),B(7)C(7),A(8),B(8),C(8)
    A(0),B(0)C(0),A(1),B(1),C(1)
    A(9),B(9)C(9),A(10),B(10),C(10)
    A(16),B(16)C(16),A(17),B(17),C(17)
    A(12),B(12)C(12),A(13),B(13),C(13)
    A(n),B(n)C(n),A(n),B(n),C(n)
    A(14),B(14)C(14),A(15),B(15),C(15)
    A(15),B(15)C(15),A(16),B(16),C(16)
    A(11),B(11)C(11),A(12),B(12),C(12)
    A(n-1),B(n-16)C(n-1),A(n-1),B(n-1),C(n-1)
    .......
    A(13),B(13)C(13),A(14),B(14),C(14)


    The sequence on each line is not changed but the line position is. The jumbling does not follow a pattern, it is random.


    When sorted correctly the data should take the form:

    A(0),B(0)C(0),A(1),B(1),C(1)
    A(1),B(1)C(1),A(2),B(2),C(2)
    A(2),B(2)C(2),A(3),B(3),C(3)
    A(3),B(3)C(3),A(4),B(4),C(4)
    A(4),B(4)C(4),A(5),B(5),C(5)
    A(5),B(5)C(5),A(6),B(6),C(6)
    A(6),B(6)C(6),A(7),B(7),C(7)
    A(7),B(7)C(7),A(8),B(8),C(8)
    A(8),B(8)C(8),A(9),B(9),C(9)
    A(9),B(9)C(9),A(10),B(10),C(10)
    A(11),B(11)C(11),A(12),B(12),C(12)
    A(12),B(12)C(12),A(13),B(13),C(13)
    A(13),B(13)C(13),A(14),B(14),C(14)
    A(14),B(14)C(14),A(15),B(15),C(15)
    A(15),B(15)C(15),A(16),B(16),C(16)
    A(16),B(16)C(16),A(17),B(17),C(17)
    ......
    A(n-1),B(n-16)C(n-1),A(n-1),B(n-1),C(n-1)
    A(n),B(n)C(n),A(n),B(n),C(n)

    Notice that for each line the last triplet matches the first triplet of the next line; however, as the lines

    """"
    A(9),B(9)C(9),A(10),B(10),C(10)
    A(11),B(11)C(11),A(12),B(12),C(12)

    """"
    show sometimes there are skips in the data.



    Does anyone have an idea for a sort alogorith that will put the data file back together?

    Any help would be appreciated.

    Thank You,
    CWCookman

    Edit,

    It looks like my example may have been too abstract. I am dealing with actual numbers, not variables with indices.

    Here is a small piece of an actual data file.


    2251098,11322792,3000,2251349,11322625,3000
    2250848,11321349,3000,2251349,11322625,3000
    2251098,11322792,3000,2249880,11323773,3000
    2249880,11323773,3000,2250587,11325115,3000
    2250848,11321349,3000,2252137,11322137,3000
    2250587,11325115,3000,2252035,11324479,3000
    2252973,11325105,3000,2253656,11324885,3000
    2252035,11324479,3000,2252973,11325105,3000
    2253656,11324885,3000,2254407,11325342,3000
    2252137,11322137,3000,2253694,11321591,3000
    2254191,11321166,3000,2253694,11321591,3000
    2254407,11325342,3000,2255890,11325936,3000
    2256065,11325874,3000,2255890,11325936,3000
    2256065,11325874,3000,2256260,11325946,3000
    2254191,11321166,3000,2255715,11322187,3000
    2255715,11322187,3000,2256107,11321912,3000
    2256107,11321912,3000,2256963,11320361,3000
    2256963,11320361,3000,2257081,11320632,3000
    2256260,11325946,3000,2256827,11326189,3000
    2256827,11326189,3000,2258439,11326557,3000
    2257081,11320632,3000,2258654,11319446,3000
    2258654,11319446,3000,2259433,11317569,3000


    I hope this clarifies things.

    The missing comma only means my typing is poor sometimes.
    CWC
    Last edited by cwcookman; Jan 23rd, 2003 at 05:46 PM.

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