Click here to Skip to main content
15,613,250 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Optimal path searching question Pin
Patrice T7-Dec-19 6:45
mvePatrice T7-Dec-19 6:45 
AnswerRe: Optimal path searching question Pin
Gerry Schmitz7-Dec-19 7:47
mveGerry Schmitz7-Dec-19 7:47 
QuestionMaking a Class Schedule Using a Genetic Algorithm Pin
ali galavi3-Dec-19 1:10
ali galavi3-Dec-19 1:10 
AnswerRe: Making a Class Schedule Using a Genetic Algorithm Pin
Richard Deeming3-Dec-19 2:10
mveRichard Deeming3-Dec-19 2:10 
QuestionFind the best path Pin
Member 146753785-Dec-19 19:45
Member 146753785-Dec-19 19:45 
AnswerRe: Find the best path Pin
Patrice T2-Dec-19 12:28
mvePatrice T2-Dec-19 12:28 
AnswerRe: Find the best path Pin
Member 146753785-Dec-19 19:45
Member 146753785-Dec-19 19:45 
QuestionHelp w/ recursive algorithm Pin
Member 1466815525-Nov-19 16:03
Member 1466815525-Nov-19 16:03 
I recently messed up this question and I can't quite figure out how to solve it. With divide and conquer we can easily tell if the substrings are palindromes (and counting them alone would be easy). But we're not supposed to count them. The long string below should yield "3" as is has 3 levels of palindromes. Not wrapping my head around how to keep track of the rank when unwinding.

"yx xy yx xy yx xy yx xy" // -- not all are palindromes, so nothing here
"yxxy yxxy yxxy yxxy" // all 4 are palindromes - level 3
"yxxyyxxy yxxyyxxy" // both are palindromes - level 2
"yxxyyxxyyxxyyxxy" // whole string is palindrome - level 1

bool isPalindrome( const std::string& str ){
    // usual palindrome stuff
    //  If not, return false, else return true;
}

int palindromeCount( const std::string& str ) { 
    if ( !isPalindrome( str ) ) return 0;
    int l = palindromeCount( firstHalfofStr );
    int r = palindromeCount( secondHalfofStr );

    int x{0};
    if (l && r ) {
        // Do something w/ x here?
    }
    
    // how to get the proper level back I never figured out.
    // It can't be just 1 for each successful palindrome
    return 1 + x;
}

AnswerRe: Help w/ recursive algorithm Pin
Gerry Schmitz26-Nov-19 6:58
mveGerry Schmitz26-Nov-19 6:58 
GeneralRe: Help w/ recursive algorithm Pin
Member 1466815526-Nov-19 15:12
Member 1466815526-Nov-19 15:12 
QuestionAlgorithm homework - Kruskal’s algorithm Pin
Member 1465409212-Nov-19 23:41
Member 1465409212-Nov-19 23:41 
AnswerRe: Algorithm homework - Kruskal’s algorithm Pin
OriginalGriff12-Nov-19 23:44
mvaOriginalGriff12-Nov-19 23:44 
QuestionAlgorithm homework Pin
Member 1465409212-Nov-19 23:41
Member 1465409212-Nov-19 23:41 
AnswerRe: Algorithm homework Pin
OriginalGriff12-Nov-19 23:43
mvaOriginalGriff12-Nov-19 23:43 
QuestionHelp to draw recursive shape inside 2d array javascript Pin
Member 146476276-Nov-19 23:00
Member 146476276-Nov-19 23:00 
AnswerRe: Help to draw recursive shape inside 2d array javascript Pin
Richard MacCutchan6-Nov-19 23:24
mveRichard MacCutchan6-Nov-19 23:24 
Questionanyone know how to implement arden's theorem or the state removal method to convert an FA to a regex expression? Pin
honey the codewitch21-Sep-19 7:54
mvahoney the codewitch21-Sep-19 7:54 
QuestionHelp with algorithmic efficiency Pin
danirdd928-Sep-19 10:52
danirdd928-Sep-19 10:52 
AnswerRe: Help with algorithmic efficiency Pin
Richard Deeming10-Sep-19 1:22
mveRichard Deeming10-Sep-19 1:22 
GeneralRe: Help with algorithmic efficiency Pin
danirdd9210-Sep-19 12:58
danirdd9210-Sep-19 12:58 
GeneralRe: Help with algorithmic efficiency Pin
Richard Deeming11-Sep-19 23:13
mveRichard Deeming11-Sep-19 23:13 
AnswerRe: Help with algorithmic efficiency Pin
Gerry Schmitz10-Sep-19 19:00
mveGerry Schmitz10-Sep-19 19:00 
GeneralRe: Help with algorithmic efficiency Pin
danirdd9210-Sep-19 22:19
danirdd9210-Sep-19 22:19 
GeneralRe: Help with algorithmic efficiency Pin
Gerry Schmitz11-Sep-19 16:36
mveGerry Schmitz11-Sep-19 16:36 
QuestionSorting algorithm faster than quick sort Pin
Shuji Kaya15-Aug-19 19:36
Shuji Kaya15-Aug-19 19:36 

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.