Thursday, December 4, 2008

Ranking cars

You work at a used car dealership, and you have an inventory of cars. Each car has several properties. We'll deal with four here-- gas mileage, body style, price, color. Your job is to create a sorted list of this inventory for each new customer.

You have two set heuristics-- when all else is the same, higher mileage or lower price should be preferred.

In your sorting algorithm, you can pose questions to the customer in the form of, "Do you prefer car A or car B?" Write an algorithm that (1) doesn't ask the customer a question if its answer can be discerned from your heuristics and previous answers (assume transitivity) and (2) chooses which questions to ask so as to minimize the total number of questions needed.

No comments: