searching within an array

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
hi all,

one of my friends faced the following question at an interview:

Which method will you follow to search a record from a million records
in an array?

Please help

Re: searching within an array

Quoted text here. Click to load it

Well, that depends, off course (that is why it is a nice question for an

If the array is sorted and the keys are numeric and all present, you can
write a binary search routine. Otherwise, there are built-in functions
that let you search both keys and values.

Best regards
Willem Bogaerts

Application smith
Kratz B.V.

Re: searching within an array

newbie wrote:

Quoted text here. Click to load it

something along the lines of:

$idiot =
apply($idiot, $cattle_prod);

I'd need to be very desperate to take this job.


Site Timeline