Click here to Skip to main content
15,895,084 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionNOAA's National Centers for Environmental Information collects global climate data and aggregates this data to provide information on climate trends and variability. One product they offer is a monthly regional analysis. The following table gives "an Pin
Member 1489532821-Jul-20 19:43
Member 1489532821-Jul-20 19:43 
AnswerRe: NOAA's National Centers for Environmental Information collects global climate data and aggregates this data to provide information on climate trends and variability. One product they offer is a monthly regional analysis. The following table gives Pin
OriginalGriff21-Jul-20 19:47
mveOriginalGriff21-Jul-20 19:47 
AnswerRe: NOAA's National Centers for Environmental Information collects global climate data and aggregates this data to provide information on climate trends and variability. One product they offer is a monthly regional analysis. The following table gives Pin
Patrice T22-Jul-20 23:03
mvePatrice T22-Jul-20 23:03 
AnswerRe: NOAA's National Centers for Environmental Information collects global climate data and aggregates this data to provide information on climate trends and variability. One product they offer is a monthly regional analysis. The following table gives Pin
Dave Kreskowiak23-Jul-20 3:39
mveDave Kreskowiak23-Jul-20 3:39 
AnswerAI: how to distinguish music from voice Pin
David_Spector20-Jul-20 2:25
David_Spector20-Jul-20 2:25 
GeneralRe: AI: how to distinguish music from voice Pin
Gerry Schmitz23-Jul-20 3:55
mveGerry Schmitz23-Jul-20 3:55 
GeneralRe: AI: how to distinguish music from voice Pin
David_Spector23-Jul-20 4:21
David_Spector23-Jul-20 4:21 
QuestionRight approach for Dynamic Programming Pin
Member 1487381426-Jun-20 13:20
Member 1487381426-Jun-20 13:20 
Hey there.
So as my final in algorithms is getting closer, I'm trying to scrutinize some DP problems from past tests.

Input: A list L of strings, and another string s.
Output: "yes" if s is a concatenation of string from L, "no" otherwise.
Example: AGAGADIR is a concatenation of strings from the list {ADI, AG, R, SI}; but the string SIRA is not. Assume that checking if a string is contained in L costs O(1). Also, notice the option of an empty string.

My way of thinking about DP solution: The aim is initially to define the right sub-problems of the main problem, and then to develop the right recursion with the suitable memoization.

Sub-problems: we'll look at the string s up to the char at index i (between 0 and Length(s) - 1) and decide if it's itself a concatenation of strings from L.

Recursion: if i == 0 then the empty list is trivially in L, continue to i = 1; if i == 1 then go over the list L and compare if there is a char element in L which equals to the first character of s - if not, check for i=2, otherwise... here I'm stuck

Can someone please direct me? Give me some sense for DP?

Thanks in advance.
AnswerRe: Right approach for Dynamic Programming Pin
Patrice T29-Jun-20 11:26
mvePatrice T29-Jun-20 11:26 
AnswerRe: Right approach for Dynamic Programming Pin
Richard MacCutchan29-Jun-20 21:50
mveRichard MacCutchan29-Jun-20 21:50 
AnswerRe: Right approach for Dynamic Programming Pin
Gerry Schmitz30-Jun-20 15:13
mveGerry Schmitz30-Jun-20 15:13 
AnswerRe: Right approach for Dynamic Programming Pin
Luc Pattyn5-Jul-20 3:40
sitebuilderLuc Pattyn5-Jul-20 3:40 
Questionwhat is being done in this algorithim Pin
Muhammad Sudais26-Jun-20 8:40
Muhammad Sudais26-Jun-20 8:40 
AnswerRe: what is being done in this algorithim Pin
Dave Kreskowiak26-Jun-20 9:06
mveDave Kreskowiak26-Jun-20 9:06 
AnswerRe: what is being done in this algorithim Pin
Richard MacCutchan26-Jun-20 22:19
mveRichard MacCutchan26-Jun-20 22:19 
QuestionDynamic Programming / Greedy algorithm - Best time with constraints Pin
Member 1487381426-Jun-20 1:04
Member 1487381426-Jun-20 1:04 
AnswerRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Richard MacCutchan25-Jun-20 23:18
mveRichard MacCutchan25-Jun-20 23:18 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Member 1487381425-Jun-20 23:30
Member 1487381425-Jun-20 23:30 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Richard MacCutchan25-Jun-20 23:43
mveRichard MacCutchan25-Jun-20 23:43 
AnswerRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Greg Utas26-Jun-20 0:42
professionalGreg Utas26-Jun-20 0:42 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Member 1487381426-Jun-20 1:00
Member 1487381426-Jun-20 1:00 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Greg Utas26-Jun-20 1:41
professionalGreg Utas26-Jun-20 1:41 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
harold aptroot26-Jun-20 1:15
harold aptroot26-Jun-20 1:15 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Member 1487381426-Jun-20 1:19
Member 1487381426-Jun-20 1:19 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
harold aptroot26-Jun-20 2:54
harold aptroot26-Jun-20 2:54 

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.