Re: searching within an array



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

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

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.
http://www.kratz.nl/
.



Relevant Pages

  • Re: comparing some but not all fields in lists
    ... and what's in common." ... I should compare only 3 of the 82 fields in each list. ... comparing all 82 fields as a single array element. ... cannot handle multiple keys as you want it to. ...
    (perl.beginners)
  • Re: Build an array from a text file
    ... Now that I have created my array, ... The dictionary object has a 'keys' method that returns a 0 based array ... Dim vArray As Variant ... dictionaries, so any help would be great! ...
    (microsoft.public.word.vba.general)
  • Re: Nugget - Using control references
    ... until someone decides they want to save a 3D array. ... If the users are likely to add elements to the middle of the enum, you should save and load by the enum text. ... What you can try is this - save both the string and the number. ... Unused keys are not deleted.  When the number of elements in an array is reduced, the key entries still exist in the file. ...
    (comp.lang.labview)
  • Re: hash sortieren nach werten, hash in =?ISO-8859-15?Q?popupmen?= =?ISO-8859-15?Q?=
    ... Dieses Array gibst Du bei -values an. ... Du schreibst Dir eine Funktion, die Dir die Keys ... des Hashes in der Sortierung der Werte liefert. ... values ist eine Referenz auf ein @rray, ...
    (de.comp.lang.perl.cgi)
  • Re: populating a hash with % used as the key and F string as the value
    ... > keys %lookup; ... it states one cannot push or pop a hash on page 10 ... itself is the reference to the array (read: an arrayref). ...
    (perl.beginners)