× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Though if the array isn't sorted you may want to use qsort as well.
Depending on the size of the array, and how often it is added to, it may
very well be faster to run qsort when an element is added and then
bsearch, than it is to use lookup. The nice thing about qsort/bsearch is
that they can be used to sort/search arrays that are not trivially
sortable, such as an array of pointers to data structures where you want
to sort based on the contents of one of the subfields of the data
structure. Or if you have a dynamically allocated array where the 
allocated length of the array is not as long as the declared length of
the array.

Also, I thought that %lookup implementing a binary search was a
relatively recent update, so even if you could use %lookup it might not
be faster than lookup if you were on an older release.

Joe Lee

>>> Jon.Paris@xxxxxxxxxxxxxx 01/13/2005 07:20:54 >>>
 >> 2) Use the C function qsort.  Again many examples including the
RPG
Redbook.

Oopppss - of course I meant bsearch.

I'm _not_ a morning person!

Jon Paris
Partner400
www.Partner400.com 



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.