# Is there an algorithm for selecting best matching data in a data set given a set of parameters? [closed]

What I am trying to do is for a diet app that I am planning to build. The goal is the users will input their desired macros (carbs, fat, protein) and the system should find all recipes that match the provided macros. It does not have to match it exactly, just the best match. Another idea is users provide their daily calorie intake and the system will find the best match, regardless of the macros.

Links and study materials are much appreciated.

• I don't see a clear problem specification here. You haven't told us what kinds of restrictions/constraints the macros can impose, nor how you want to measure which match is the best (i.e., how you want to measure how good a match each recipe is). Without that, I don't think this question is answerable; we're forced to guess what you might have in mind. Also, we require you to articulate a specific answerable question. "Links and study materials are much appreciated." is not a question. – D.W. Mar 12 '19 at 16:45

Assuming you don't have that many recipes, you could just go over all of them and choose the best $$k$$ (use a heap of size $$k$$). You should test the naive approach before looking for fancier approaches.