On Thursday, November 10, 2022 at 3:19:35 PM UTC-8, James Van Buskirk wrote:
(snip)
> I think that I have previously post AVL tree code to this forum.
> It is unfortunate that you have not fleshed your ideas out by
> posting code like:
> integer n
> real(REAL64) harvest
> call RANDOM_NUMBER(harvest)
> n = HUGE(n)*harvest
> ! Now insert n into your data structure...
> So as to compare performance between the example you posted
> and your proposed data structure solution...
Many years ago for a CS class assignment I did a heapsort program.
(In PDP-10 ALGOL!) That was based on the explanation in
Knuth's volume 3, which I think I bought to do that assignment.
I have not actually tried to write one since then.
I think, though, it depends somewhat on how, and how often, you
go through the sorted data.
As well as I know, your original program goes through the array
four times for each call. One to create the mask. One to extract
the location from the mask. One to copy into the return array.
One to copy the return array to the called program array.
Though that only means a 4 in front of the N**2.
OK, now another Fortran tree story.
The IBM Fortran H compiler stores the symbol table in six
balanced trees, instead of a hash table. In the manual, they
suggest that for faster compilation, you distribute your names
equally between 1 and 6 characters!
No suggestion that you choose names for readability, though.