Click here to Skip to main content
15,887,313 members
Home / Discussions / Algorithms
   

Algorithms

 
Questionanalysis of boolean table to optimize code ? Pin
BillWoodruff30-Oct-15 22:59
professionalBillWoodruff30-Oct-15 22:59 
AnswerRe: analysis of boolean table to optimize code ? Pin
Gerry Schmitz3-Nov-15 8:28
mveGerry Schmitz3-Nov-15 8:28 
AnswerRe: analysis of boolean table to optimize code ? Pin
Patrice T3-Nov-15 17:09
mvePatrice T3-Nov-15 17:09 
Questiongrid search Pin
Member 1208345324-Oct-15 0:21
Member 1208345324-Oct-15 0:21 
AnswerRe: grid search Pin
Patrice T24-Oct-15 22:12
mvePatrice T24-Oct-15 22:12 
AnswerRe: grid search Pin
Richard MacCutchan24-Oct-15 22:48
mveRichard MacCutchan24-Oct-15 22:48 
AnswerRe: grid search Pin
BillWoodruff30-Oct-15 23:10
professionalBillWoodruff30-Oct-15 23:10 
QuestionA max profit question Pin
JStagg14-Oct-15 23:15
JStagg14-Oct-15 23:15 
A very stupid question. I have a problem where the scenario is similar to playing a game with the character may buy/ sell magic items one at a time in the inventory store; and the magic item may generate e.g. MP according to the purchased item. Each item can be sold after buying that item (the player can't sell the item that he/she didn't purchase). Also each day the inventory store may sell an item (so player can only decide buy it or not). The last constraint is a fixed time (e.g. 10 days) the player/ character can keep the item purchased.

I search on the internet, it seems this can be solved by dynamic programming or greedy algorithm. But I can't figure out the solution because many examples on the internet e.g. activities selection are different from this one. For instance I understand the following one, but can't map that to the question I have.

http://www.geeksforgeeks.org/greedy-algorithms-set-1-activity-selection-problem/

A sample data for this question:

- the inventory store will sell items for 8 days.
- initially the player/ character keeps 10 coins.
- the player/ character can keep the item for 20 days.

For each day the item to be sold
day 1: the item costs 9 coins with 2 MP generated per day; the inventory store will buy it back with 1 coin.
day 2: the item costs 10 coins with 1 MP generated per day; the inventory store will buy it back with 9 coins.
day 3: the item costs 2 coins with 2 MP generated per day; the inventory store will buy it back with 1 coin.
day 4: the item costs 11 coins with 4 MP generated per day; the inventory store will buy it back with 7 coins.
day 5: no item available.
day 6: the item costs 12 coins with 3 MP generated per day; the inventory store will buy it back with 1 coin.
day 7: no item available.
day 8: the item costs 20 coins with 4 MP generated per day; the inventory will buy it back with 5 coin.

Can anyone suggest some hints (e.g. how to divide the problem into sub ones) or point me to the doc that may have better explanation regarding to this question?

Many thanks
AnswerRe: A max profit question Pin
Eddy Vluggen20-Oct-15 7:39
professionalEddy Vluggen20-Oct-15 7:39 
QuestionHow can I found max of multiplication of subtree nodes? Pin
mortalphilosopher11-Oct-15 19:56
mortalphilosopher11-Oct-15 19:56 
GeneralRe: How can I found max of multiplication of subtree nodes? Pin
harold aptroot11-Oct-15 21:54
harold aptroot11-Oct-15 21:54 
AnswerRe: How can I found max of multiplication of subtree nodes? Pin
Patrice T13-Oct-15 10:09
mvePatrice T13-Oct-15 10:09 
GeneralRe: How can I found max of multiplication of subtree nodes? Pin
mortalphilosopher13-Oct-15 23:28
mortalphilosopher13-Oct-15 23:28 
GeneralRe: How can I found max of multiplication of subtree nodes? Pin
Matt T Heffron14-Oct-15 8:09
professionalMatt T Heffron14-Oct-15 8:09 
QuestionData selection and classification algorithms Pin
Member 120412687-Oct-15 13:15
Member 120412687-Oct-15 13:15 
SuggestionRe: Data selection and classification algorithms Pin
Matt T Heffron7-Oct-15 14:29
professionalMatt T Heffron7-Oct-15 14:29 
GeneralRe: Data selection and classification algorithms Pin
Member 120412687-Oct-15 16:55
Member 120412687-Oct-15 16:55 
QuestionHow you gonna start with this question? Pin
lebanner6-Oct-15 14:52
lebanner6-Oct-15 14:52 
AnswerRe: How you gonna start with this question? Pin
Afzaal Ahmad Zeeshan6-Oct-15 22:14
professionalAfzaal Ahmad Zeeshan6-Oct-15 22:14 
AnswerRe: How you gonna start with this question? Pin
Sreram K8-Oct-15 7:17
Sreram K8-Oct-15 7:17 
AnswerRe: How you gonna start with this question? Pin
Patrice T8-Oct-15 11:47
mvePatrice T8-Oct-15 11:47 
GeneralRe: How you gonna start with this question? Pin
Matt T Heffron8-Oct-15 14:23
professionalMatt T Heffron8-Oct-15 14:23 
GeneralRe: How you gonna start with this question? Pin
Stanley_B70716-Oct-15 5:18
Stanley_B70716-Oct-15 5:18 
AnswerRe: How you gonna start with this question? Pin
Matt T Heffron20-Oct-15 7:05
professionalMatt T Heffron20-Oct-15 7:05 
QuestionWhy is Dijkstra's algorithm implemented with a priority queue O(|E| + |v|log|V|)? Shouldn't it be O(|V|^2)? Pin
Sreram K5-Oct-15 4:45
Sreram K5-Oct-15 4:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.