All pastes #439057 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-04-14 00:50 UTC
rendered paste body
Assume a list of objects with properties P1, P2, ... , Pk which is sorted using those properties.
Each property can be either a known value or a wildcard (*).

You have a set of properties S.

Is there a better method to determine if an object with properties that match S exists in the list other than linear search?

I've come up with a version space search method (essentially a general tree with a level for each attribute), but i'm wondering if i've missed something simpler.

Example:

You have the list

P1 P2  P3 Obj
1  1.0 3   A
10 5.2 2   B
3  0.2 68  C
87 4.1 2   D
5  *   2   E
*  *   3   F

the property set (5  3.0  3) would match F

the property set (5  3.0  2) would match E

the property set (3  0.2  68) would match C

the property set (1  1.2  6) would not match anything