i have 1,000,000 objects. need match them 4 different properties within specified range .
- length (10meters - 20meters)
- breadth (12meters - 18meters)
- height (3meters - 6meters)
- color (red)
a simple loop isnt efficient way go it. type of collections should looking implement? how should i've approached problem.
a navigableset might work you. need define different comparator each of properties. basically, start set sorted 1 property , subset fits range. place subset navigableset sorted comparator second property... repeat.
but don't think of beats o(n) time :p since sort o(nlogn). @ least interesting.
Comments
Post a Comment