Click here to Skip to main content
15,505,126 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 20:43
Member 1489532821-Jul-20 20: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 20:47
mveOriginalGriff21-Jul-20 20: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 T23-Jul-20 0:03
mvePatrice T23-Jul-20 0: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 4:39
mveDave Kreskowiak23-Jul-20 4:39 
AnswerAI: how to distinguish music from voice Pin
David_Spector20-Jul-20 3:25
David_Spector20-Jul-20 3:25 
GeneralRe: AI: how to distinguish music from voice Pin
Gerry Schmitz23-Jul-20 4:55
mveGerry Schmitz23-Jul-20 4:55 
GeneralRe: AI: how to distinguish music from voice Pin
David_Spector23-Jul-20 5:21
David_Spector23-Jul-20 5:21 
QuestionRight approach for Dynamic Programming Pin
Member 1487381426-Jun-20 14:20
Member 1487381426-Jun-20 14: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 12:26
mvePatrice T29-Jun-20 12:26 
AnswerRe: Right approach for Dynamic Programming Pin
Richard MacCutchan29-Jun-20 22:50
mveRichard MacCutchan29-Jun-20 22:50 
AnswerRe: Right approach for Dynamic Programming Pin
Gerry Schmitz30-Jun-20 16:13
mveGerry Schmitz30-Jun-20 16:13 
AnswerRe: Right approach for Dynamic Programming Pin
Luc Pattyn5-Jul-20 4:40
sitebuilderLuc Pattyn5-Jul-20 4:40 
Questionwhat is being done in this algorithim Pin
Muhammad Sudais26-Jun-20 9:40
Muhammad Sudais26-Jun-20 9:40 
AnswerRe: what is being done in this algorithim Pin
Dave Kreskowiak26-Jun-20 10:06
mveDave Kreskowiak26-Jun-20 10:06 
AnswerRe: what is being done in this algorithim Pin
Richard MacCutchan26-Jun-20 23:19
mveRichard MacCutchan26-Jun-20 23:19 
QuestionDynamic Programming / Greedy algorithm - Best time with constraints Pin
Member 1487381426-Jun-20 2:04
Member 1487381426-Jun-20 2:04 
AnswerRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Richard MacCutchan26-Jun-20 0:18
mveRichard MacCutchan26-Jun-20 0:18 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Member 1487381426-Jun-20 0:30
Member 1487381426-Jun-20 0:30 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Richard MacCutchan26-Jun-20 0:43
mveRichard MacCutchan26-Jun-20 0:43 
AnswerRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Greg Utas26-Jun-20 1:42
mveGreg Utas26-Jun-20 1:42 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Member 1487381426-Jun-20 2:00
Member 1487381426-Jun-20 2:00 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Greg Utas26-Jun-20 2:41
mveGreg Utas26-Jun-20 2:41 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
harold aptroot26-Jun-20 2:15
harold aptroot26-Jun-20 2:15 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
Member 1487381426-Jun-20 2:19
Member 1487381426-Jun-20 2:19 
GeneralRe: Dynamic Programming / Greedy algorithm - Best time with constraints Pin
harold aptroot26-Jun-20 3:54
harold aptroot26-Jun-20 3: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.