Re: is there an API for quick searching of an array?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I didn't follow the whole thread, but maybe you could use a collection instead of an array (or use a collection
as a tester for uniqueness) and take advantage of the fact
that the key of a collection item can only be unique.

RBS

"Mike Scirocco" <mscir@xxxxxxxxx> wrote in message news:7oydnZNWduKS3YHbnZ2dnUVZ_tKjnZ2d@xxxxxxxxxxxxxxxxx
I am filling arrays of up to 25000 elements with string data, and I have to make sure each entry is unique, so as the array gets filled from element 0 to 24999 I have to check all of the previous element contants to make sure none of them match the new entry.

Is there an API for a fast array search? Right now I'm just looping through the array like this:

tryagain:
'get new data point to include in array if it's unique
newvalue = "somedata"

dim n as long
for n = lbound(mydata) to ubound(mydata)
'see if newvalue exists in array yet
if mydata(n)=newvalue then goto tryagain
next

Mike

.



Relevant Pages

  • Re: Semi-newbie, rolling my own __deepcopy__
    ... This version does not copy types like module, class, function, method, stack trace, stack frame, file, socket, window, *array*, or any similar types. ... On reflection, I realize that this says that the array type is not deep-copyable, not array instances. ... it does appear that array instances don't play nicely with deepcopy ...
    (comp.lang.python)
  • Re: is there an API for quick searching of an array?
    ... to make sure none of them match the new entry. ... Is there an API for a fast array search? ... 'see if newvalue exists in array yet ... if mydata=newvalue then goto tryagain ...
    (microsoft.public.vb.winapi)
  • is there an API for quick searching of an array?
    ... I am filling arrays of up to 25000 elements with string data, and I have to make sure each entry is unique, so as the array gets filled from element 0 to 24999 I have to check all of the previous element contants to make sure none of them match the new entry. ... Is there an API for a fast array search? ... 'see if newvalue exists in array yet ...
    (microsoft.public.vb.winapi)