Click here to Skip to main content
15,900,680 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Sorting algorithm faster than quick sort Pin
DaveAuld20-Aug-19 20:29
professionalDaveAuld20-Aug-19 20:29 
AnswerRe: Sorting algorithm faster than quick sort Pin
Shuji Kaya16-Aug-19 21:51
Shuji Kaya16-Aug-19 21:51 
QuestionBoruvka & Prim´s algorithm Pin
Mata Machalová13-Aug-19 2:43
Mata Machalová13-Aug-19 2:43 
AnswerRe: Boruvka & Prim´s algorithm Pin
Richard MacCutchan13-Aug-19 6:55
mveRichard MacCutchan13-Aug-19 6:55 
QuestionIf I have two algorithms, one has a running time of 100n^2 and the other has a run time of 2^n, what is the smallest value I can use to make 100n^2 run faster than 2^n? Pin
Matt_Booty18-Jul-19 8:00
Matt_Booty18-Jul-19 8:00 
AnswerRe: If I have two algorithms, one has a running time of 100n^2 and the other has a run time of 2^n, what is the smallest value I can use to make 100n^2 run faster than 2^n? Pin
Richard Deeming22-Jul-19 7:49
mveRichard Deeming22-Jul-19 7:49 
GeneralRe: If I have two algorithms, one has a running time of 100n^2 and the other has a run time of 2^n, what is the smallest value I can use to make 100n^2 run faster than 2^n? Pin
Matt_Booty22-Jul-19 8:34
Matt_Booty22-Jul-19 8:34 
QuestionTrying to program advanced Sudoku techniques Pin
haackeDc11-Jul-19 7:11
haackeDc11-Jul-19 7:11 
Some of the techniques require building chains
that jump from one candidate to another, sometimes to different cells, sometimes to different candidates within the same cell.

The chain lengths can be anywhere between 4 and 30 nodes long, and the amount of possible chains that can be made is quite a large number.

My code is technically working and can find the chains I am looking for, but it can take 20 seconds to find a single useful chain sometimes.

Right now I am building the chains using nodes in a tree in a linked-list format, and using recursion to continue the chain. When a terminal node is found it is added to a list to be tested. Then it breaks the chain into smaller ones and tries them too.

The problem is that I am probably building chains more than once (because a chain is the the same both forwards and backwards), and I am not sure how I can eliminate redundancy.

Or maybe the problem is that I am using recursion and I should be using iteration, but I am not sure the best method to iterate with.

This is the recursive call within the function:

if (currNode.children.Count > 0)
        {
            for (int n = 0; n < currChildCount; n++)
            {//Contine recursion on chilren
                temp = currNode.children[n];
                BuildAIC(temp, temp.note, terminalNodes, !findStrongLink);


When the recursive loop finishes, I will have all the chains that can be built starting from one point.

I iterate through each point and each note in each point and then check the terminal nodes like this:

foreach (Point p in UnsolvedCells)
       {
           foreach (int note in cells[p.Y, p.X].notes.ToList())
           {
               ancestor = new NodeAIC(p, note);
               BuildAIC(ancestor, note, terminalNodes, true);

               for (int n = 0; n < terminalNodes.Count; n++)
               {
                     /* Test Chains Here */


Can anyone give me some ideas?
AnswerRe: Trying to program advanced Sudoku techniques Pin
Gerry Schmitz12-Jul-19 6:02
mveGerry Schmitz12-Jul-19 6:02 
AnswerRe: Trying to program advanced Sudoku techniques Pin
53x1513-Sep-19 6:09
53x1513-Sep-19 6:09 
QuestionFiguring out when one algorithm will be slower than another algorithm. Pin
Member 145257479-Jul-19 11:20
Member 145257479-Jul-19 11:20 
GeneralRe: Figuring out when one algorithm will be slower than another algorithm. Pin
harold aptroot9-Jul-19 22:19
harold aptroot9-Jul-19 22:19 
AnswerRe: Figuring out when one algorithm will be slower than another algorithm. Pin
Gerry Schmitz10-Jul-19 6:39
mveGerry Schmitz10-Jul-19 6:39 
Questionwhat does this algorithm do ? Pin
Member 145190962-Jul-19 13:34
Member 145190962-Jul-19 13:34 
AnswerRe: what does this algorithm do ? Pin
Maciej Los3-Jul-19 8:33
mveMaciej Los3-Jul-19 8:33 
AnswerRe: what does this algorithm do ? Pin
Patrice T6-Jul-19 12:33
mvePatrice T6-Jul-19 12:33 
QuestionBetter operating system than 64 bit? Pin
Member 145095551-Jul-19 19:39
Member 145095551-Jul-19 19:39 
AnswerRe: Better operating system than 64 bit? Pin
OriginalGriff1-Jul-19 19:51
mveOriginalGriff1-Jul-19 19:51 
GeneralRe: Better operating system than 64 bit? Pin
Richard Deeming2-Jul-19 1:28
mveRichard Deeming2-Jul-19 1:28 
QuestionPuchi and Luggage. Wrong Answer for some test cases. Pin
Member 144776851-Jun-19 9:24
Member 144776851-Jun-19 9:24 
SuggestionRe: Puchi and Luggage. Wrong Answer for some test cases. Pin
Richard MacCutchan1-Jun-19 21:32
mveRichard MacCutchan1-Jun-19 21:32 
QuestionWhat kind of structure can it be? Pin
Member 1447661631-May-19 0:24
Member 1447661631-May-19 0:24 
AnswerRe: What kind of structure can it be? Pin
Richard MacCutchan31-May-19 1:09
mveRichard MacCutchan31-May-19 1:09 
QuestionAlgorithm to find maximum sum in an array given that the elements have unique digits Pin
akshit bhatia28-May-19 9:02
akshit bhatia28-May-19 9:02 
AnswerRe: Algorithm to find maximum sum in an array given that the elements have unique digits Pin
Patrice T1-Jun-19 10:12
mvePatrice T1-Jun-19 10:12 

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.