Hello and thank you for your time and patience to help me.
I'm struggling with this problem and I really don't know where to start, please help me with the algorithm, I mean the steps that my program need to do to solve this problem, I'm not asking for codes here.
Here is the problem: Given the user's budget and N kinds of table each has a quantity of 1 and follow the below structures
1 2 3 4

struct Tables {
char name[100];
int price;
};
 
Write a program to output the table(s) which the user need to buy to use up all of their money or having the least money left.
For example, if I have 4 tables A, B, C, D whose price is $400, $150, $900 and $200 respectively. When the user input their budget is $1000 then the program will return table C. When the user input $350 it will return tables B and D.
Please help me with the part how get the table(s) whose price or combined price is the the biggest and closest to the user's input budget?
At first I'm thinking about calculating the price of 1 table, combined of 2 tables, combined of 3 tables,... then compare their this differences with the budget but this method would be inefficient for a large amount of data.
Again, I'm only asking for the steps that my program need to do complete the task, I'll try to figure out the codes myself. Thank you very much for your help and sorry for my bad English, if the problem sounds unclear to you, please ask for information.