Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a built-in function to SEARCH a sorted array?

Status
Not open for further replies.

theSeeker03

Programmer
Jan 16, 2004
17
US
like, if I have a sorted array of strings and I want to know if string "hi" is in it. I could obviously just loop through every cell, but that would not be time effecient. Is there a built-in function that searches for a value and takes advantage of the fact that array is sorted?
 
no, sorry

you could write a binary chop search fairly easily that would speed things up considerably though, for larger arrays anwyay - for shorter arrays (a few hundred elements?) it might well be faster just to zip through the array.

Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top