Find recipes that can be cooked from provided ingridients

Posted by skaurus on Stack Overflow See other posts from Stack Overflow or by skaurus
Published on 2010-04-19T13:36:15Z Indexed on 2010/04/19 14:43 UTC
Read the original article Hit count: 195

Sorry for bad English :(

Suppose i can preliminary organize recipes and ingredients data in any way.
How can i effectively conduct search of recipes by user-provided ingredients, preferably sorted by max match - so, first going recipes that use maximum of provided ingridients and do not contain any other ingrs, after them recipes that uses less of provided set and still not any other ingrs, after them recipes with minimum additional requirements and so on?

All i can think about is represent recipe ingridients like bitmasks, and compare required bitmask with all recipes, but it is obviously a bad way to go.

And related things like Levenstein distance i don't see how to use here.

I believe it should be quite common task...

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about best-practices