Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

quicksort

Im trying to implement a high-level quicksort algorithm using a specialized database object using tFilestream. it seems to work ok until i get to about 600,000 records, then i get stack overflows. mostly this is all upramping from taking the whole database and creating an indexed field to sort in a textfile, then running a batchfile "sort index.txt > index_sort.txt".

basically, i'd like to see it run as fast or faster than good ol' DOS sort. any ideas?

entropy

Comments

  • johovishtajohovishta Member Posts: 20
    : Im trying to implement a high-level quicksort algorithm using a specialized database object using tFilestream. it seems to work ok until i get to about 600,000 records, then i get stack overflows. mostly this is all upramping from taking the whole database and creating an indexed field to sort in a textfile, then running a batchfile "sort index.txt > index_sort.txt".
    :
    : basically, i'd like to see it run as fast or faster than good ol' DOS sort. any ideas?
    :
    : entropy
    :
    maybe a silly question but is your quicksort a recursive implementation cos that might cause an overflow...
    - Johovishta
  • PsychoClownPsychoClown Member Posts: 9
    : Im trying to implement a high-level quicksort algorithm using a specialized database object using tFilestream. it seems to work ok until i get to about 600,000 records, then i get stack overflows. mostly this is all upramping from taking the whole database and creating an indexed field to sort in a textfile, then running a batchfile "sort index.txt > index_sort.txt".
    :
    : basically, i'd like to see it run as fast or faster than good ol' DOS sort. any ideas?
    :
    : entropy
    :

    Use TList.Sort if you can. It uses a reduced recursion version of quicksort, this can solve your problems with stack.

    Another solution, use shell sort, or something like that...
    --
    Long live Rock & Roll!

    Psycho Clown.


Sign In or Register to comment.