Up |
|
|
  |
Author: FrankFrank Date: Aug 29, 2008 13:03
I am being lazy, thought I would ask if you could point me in the
direction of a sorting routine. I simply want to sort the elements in
an array. I have done it before just didn't want to start again from
scratch. Yes I did search the archives and nothing turned up.
Frank
|
| |
|
| | 61 Comments |
|
  |
Author: roger.levyroger.levy Date: Aug 29, 2008 14:23
On Aug 29, 4:03Â pm, Frank yahoo.com> wrote:
> I am being lazy, thought I would ask if you could point me in the
> direction of a sorting routine. Â I simply want to sort the elements in
> an array. Â I have done it before just didn't want to start again from
> scratch. Yes I did search the archives and nothing turned up.
>
> Frank
|
| |
|
| | no comments |
|
  |
Author: John PassanitiJohn Passaniti Date: Aug 29, 2008 14:26
Frank wrote:
> I am being lazy, thought I would ask if you could point me in the
> direction of a sorting routine. I simply want to sort the elements in
> an array. I have done it before just didn't want to start again from
> scratch. Yes I did search the archives and nothing turned up.
What kind of data is in each element of the array?
What kind of comparison is needed to know the order?
How many elements in the array?
How unsorted is the array (completely random, only a few entries out of
order, unknown)?
How often do you need to sort (just once when you start, whenever you
get new data, periodically at some rate)?
Do you know why I'm asking you these questions?
|
| |
| no comments |
|
  |
Author: C. G. MontgomeryC. G. Montgomery Date: Aug 29, 2008 14:38
> I am being lazy, thought I would ask if you could point me in the
> direction of a sorting routine. I simply want to sort the elements in
> an array. I have done it before just didn't want to start again from
> scratch. Yes I did search the archives and nothing turned up.
>
> Frank
Algorithm 15 in the Forth Scientific Library is a shell sort for floating
point arrays, which could easily be adapted to arrays of other types.
http://www.taygeta.com/fsl/library/shellsrt.seq
If a shell sort is suitable for your problem.
regards cgm
|
| |
| no comments |
|
  |
Author: FrankFrank Date: Aug 29, 2008 14:42
Thank you John for reminding me...Yes I know why you are asking. I am
a scientific-engineer and the more info I have the better I can answer
a question.
The data is numeric, completely random. It needs to be sorted any time
the list grows. The list starts at ~ 260 and can grow to well no
limit. The array is dynamic and increases in size as it needs. At the
moment it has 350 of 512 elements occupied. Imagine the list is your
vocabulary in a hash form it grows as you do.
Frank
|
| Show full article (1.27Kb) |
| no comments |
|
  |
Author: FrankFrank Date: Aug 29, 2008 14:45
Thanks for the link but it failed:
Quicksort (Forth
From LiteratePrograms
Jump to: navigation, search
There is currently no text in this page
Got another?
Frank
|
| Show full article (0.74Kb) |
| 1 Comment |
|
  |
Author: Thomas PorninThomas Pornin Date: Aug 29, 2008 15:06
According to Frank yahoo.com>:
> I am being lazy, thought I would ask if you could point me in the
> direction of a sorting routine. I simply want to sort the elements in
> an array. I have done it before just didn't want to start again from
> scratch. Yes I did search the archives and nothing turned up.
A good question might be: why isn't a sort word defined in
ANS Forth ? Even C has qsort().
--Thomas Pornin
|
| |
| no comments |
|
  |
Author: Marcel HendrixMarcel Hendrix Date: Aug 29, 2008 15:06
Frank yahoo.com> writes Re: Sorting routine
> Thanks for the link but it failed:
> Quicksort (Forth
> From LiteratePrograms
> Jump to: navigation, search
> There is currently no text in this page
> Got another?
|
| |
| no comments |
|
  |
Author: Ian OsgoodIan Osgood Date: Aug 29, 2008 15:20
On Aug 29, 3:06Â pm, Thomas Pornin bolet.org> wrote:
> According to Frank  yahoo.com>:
>
>> I am being lazy, thought I would ask if you could point me in the
>> direction of a sorting routine. Â I simply want to sort the elements in
>> an array. Â I have done it before just didn't want to start again from
>> scratch. Yes I did search the archives and nothing turned up.
>
> A good question might be: why isn't a sort word defined in
> ANS Forth ? Even C has qsort().
>
> Â Â Â Â --Thomas Pornin
|
| Show full article (1.01Kb) |
| no comments |
|
  |
|
|
  |
Author: Ian OsgoodIan Osgood Date: Aug 29, 2008 15:29
On Aug 29, 2:42Â pm, Frank yahoo.com> wrote:
> Thank you John for reminding me...Yes I know why you are asking. Â I am
> a scientific-engineer and the more info I have the better I can answer
> a question.
>
> The data is numeric, completely random. It needs to be sorted any time
> the list grows. The list starts at ~ 260 and can grow to well no
> limit. The array is dynamic and increases in size as it needs. At the
> moment it has 350 of 512 elements occupied. Imagine the list is your
> vocabulary in a hash form it grows as you do.
>
> Frank
|
| Show full article (0.96Kb) |
| no comments |
|
RELATED THREADS |
  |
|
|
|
|