Click here to Skip to main content
15,881,882 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Which is the more preferred approach for novice coders, depth first search, or, breadth first search? Pin
David Camp5-Oct-22 14:51
David Camp5-Oct-22 14:51 
AnswerRe: Which is the more preferred approach for novice coders, depth first search, or, breadth first search? Pin
prestige primrose hills phase 210-Nov-22 22:21
professionalprestige primrose hills phase 210-Nov-22 22:21 
AnswerRe: Which is the more preferred approach for novice coders, depth first search, or, breadth first search? Pin
Provident Ecopolitan Bagalur20-Jul-23 21:09
Provident Ecopolitan Bagalur20-Jul-23 21:09 
QuestionFind cartesians for matrix elements Pin
Member 1528858613-Jul-21 19:38
Member 1528858613-Jul-21 19:38 
QuestionGuess A Word If Number Of Character Matches Are Given Pin
Member 1525570320-Jun-21 20:54
Member 1525570320-Jun-21 20:54 
AnswerRe: Guess A Word If Number Of Character Matches Are Given Pin
OriginalGriff20-Jun-21 21:01
mveOriginalGriff20-Jun-21 21:01 
QuestionWhat are the in-order and post-order traversals of the following tree? Pin
priyamtheone20-May-21 5:02
priyamtheone20-May-21 5:02 
AnswerRe: What are the in-order and post-order traversals of the following tree? Pin
harold aptroot20-May-21 7:08
harold aptroot20-May-21 7:08 
1-2 and 2-2, maybe. I'll explain the reasoning, and why there is a "maybe".

Let's do the post-order one first, that's easier. OK so both answer start with "U T S X P R Y C B", so let's say we've just gone up out of B, and are looking at A right now (not "visiting" it yet though), so we recurse into L, which recurses into D, into E, into F, into G, into I, and then we come back up, so after B comes I, not D.

Or to put it in a different way: in a post-order traversal, a node is visited only after all its descendants, so there is no way D could be in the middle of this sequence, it has to be near the end. Only L and A could ever go after it.

The in-order question has two answers that start with "U S T X C P Y R B A", so let's say we're at A again, recursing into L, D, D's left child (null), then D itself, so it's the second answer. But here's why I added "maybe": "U S T X C P Y R B A" is not even the right sequence to start with, because it puts B after C but C is the right child of B so B should been visited before C. Both answers are wrong. But the first answer is worse: it gets more of the sequence wrong.

GeneralRe: What are the in-order and post-order traversals of the following tree? Pin
priyamtheone20-May-21 9:37
priyamtheone20-May-21 9:37 
GeneralRe: What are the in-order and post-order traversals of the following tree? Pin
harold aptroot20-May-21 9:48
harold aptroot20-May-21 9:48 
QuestionAlgorithm to rank items lower if they already appear higher in another category Pin
Member 117824613-Mar-21 19:41
Member 117824613-Mar-21 19:41 
AnswerRe: Algorithm to rank items lower if they already appear higher in another category Pin
Ralf Meier9-Mar-21 5:55
mveRalf Meier9-Mar-21 5:55 
QuestionSaving Hierarchical (Treeview) object Iteratively with parent and child in C# Pin
Md NasirUddin24-Feb-21 5:35
Md NasirUddin24-Feb-21 5:35 
AnswerRe: Saving Hierarchical (Treeview) object Iteratively with parent and child in C# Pin
Gerry Schmitz24-Feb-21 6:28
mveGerry Schmitz24-Feb-21 6:28 
QuestionDesign a brute force algorithm to count the number of inversions in an array, analyze the number of executions of its basic operation, and determine the efficiency class. Pin
Ilyas Idrees8-Feb-21 5:42
Ilyas Idrees8-Feb-21 5:42 
AnswerRe: Design a brute force algorithm to count the number of inversions in an array, analyze the number of executions of its basic operation, and determine the efficiency class. Pin
20212a24-Feb-21 7:22
20212a24-Feb-21 7:22 
AnswerRe: Design a brute force algorithm to count the number of inversions in an array, analyze the number of executions of its basic operation, and determine the efficiency class. Pin
Patrice T25-Feb-21 2:57
mvePatrice T25-Feb-21 2:57 
QuestionLooking for "card playing" algorithm Pin
David Crow4-Jan-21 9:30
David Crow4-Jan-21 9:30 
AnswerRe: Looking for "card playing" algorithm Pin
Ralf Meier4-Jan-21 9:43
mveRalf Meier4-Jan-21 9:43 
AnswerRe: Looking for "card playing" algorithm Pin
Peter_in_27804-Jan-21 11:15
professionalPeter_in_27804-Jan-21 11:15 
GeneralRe: Looking for "card playing" algorithm Pin
jsc426-Jan-21 4:33
professionaljsc426-Jan-21 4:33 
GeneralRe: Looking for "card playing" algorithm Pin
Peter_in_27806-Jan-21 12:46
professionalPeter_in_27806-Jan-21 12:46 
AnswerRe: Looking for "card playing" algorithm Pin
Gerry Schmitz5-Jan-21 3:27
mveGerry Schmitz5-Jan-21 3:27 
Questionformulate an algorithm Pin
Member 1502086714-Dec-20 6:59
Member 1502086714-Dec-20 6:59 
AnswerRe: formulate an algorithm Pin
Greg Utas14-Dec-20 7:31
professionalGreg Utas14-Dec-20 7:31 

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.