[prev] [index] [next]

Searching (cont)

Assume that we are dealing largely with primary keys.

Search problem can be encapsulated as:

Item search(Collection c, Key k) { ... }

Possible return values:

  • an Item
  • a distinguished "NOT FOUND" value

For secondary keys ... return an array (possibly empty) of matching items

Item *search(Collection c, key k) { ... }