locked
please help by sort RRS feed

  • Question

  • show WCD663


    Best Regards Martin

    Saturday, July 21, 2012 6:18 PM

Answers

  • Perhaps using the sort algorithm I showed, such as, WCD663-0.

    Using LDSort, you need to use the j as the write output order:

    Sub OutputLine
      GraphicsWindow.DrawText(10, j * 15 + p, A[i]["Name"])
      GraphicsWindow.DrawText(150, j * 15 + p, A[i]["Straße"])
      GraphicsWindow.DrawText(300, j * 15 + p, A[i]["Ort"])
    EndSub 

    Also, then for the unsorted list set j = i:

    p = 15
    For i = 1 To LI
      j = i
      OutputLine()
    EndFor 

    The slowness will come from large array sizes.  For more than say 500 entries, I might consider one of the fast array extensions like LDArray, but this may be tricky.  Perhaps like this, only using SB arrays for the data of each line, import PRG745.  With this it takes about 1 sec to sort 30000 entries.

    • Edited by litdev Sunday, July 22, 2012 9:49 AM
    • Marked as answer by martmen Sunday, July 22, 2012 12:09 PM
    Sunday, July 22, 2012 9:11 AM

All replies

  • Here is a string sorting algorithm, which you should be able to modify to sort on different indices ("Name", "Ort", "Straße") of your array.  Import BZK234.

    The mods required are quite straight forward, if you want I can post the solution or you can work on it yourself.

    • Edited by litdev Saturday, July 21, 2012 9:47 PM
    Saturday, July 21, 2012 9:35 PM
  • The string sorting algorithm is to slow. I need LDSort but it doesnt work fine. Please show BRR848.

    Thank you and


    Best Regards Martin

    Sunday, July 22, 2012 12:19 AM
  • Perhaps using the sort algorithm I showed, such as, WCD663-0.

    Using LDSort, you need to use the j as the write output order:

    Sub OutputLine
      GraphicsWindow.DrawText(10, j * 15 + p, A[i]["Name"])
      GraphicsWindow.DrawText(150, j * 15 + p, A[i]["Straße"])
      GraphicsWindow.DrawText(300, j * 15 + p, A[i]["Ort"])
    EndSub 

    Also, then for the unsorted list set j = i:

    p = 15
    For i = 1 To LI
      j = i
      OutputLine()
    EndFor 

    The slowness will come from large array sizes.  For more than say 500 entries, I might consider one of the fast array extensions like LDArray, but this may be tricky.  Perhaps like this, only using SB arrays for the data of each line, import PRG745.  With this it takes about 1 sec to sort 30000 entries.

    • Edited by litdev Sunday, July 22, 2012 9:49 AM
    • Marked as answer by martmen Sunday, July 22, 2012 12:09 PM
    Sunday, July 22, 2012 9:11 AM