Looking for an algorithm in vb.net or c# but I don't know it's name!
Posted
by Jules
on Stack Overflow
See other posts from Stack Overflow
or by Jules
Published on 2010-04-14T08:55:04Z
Indexed on
2010/04/14
9:03 UTC
Read the original article
Hit count: 252
I'll do my best to explain what the algorithm is supposed to do:
There's a class 'Recipe'. Each Recipe can include other Recipes but cannot include itself or any other Recipe that includes it.
So, a simple example is we have just two Recipes A & B.
If A adds B first, then later on B cannot add A because it will cause a loop.
A more complicated example is:
A,B,C
(1) Recipe C Adds B
(2) Recipe B Adds A
(3) Recipe A attempts to add C, but can't because of the relationship. C - B - A.
I can do this myself, I just wondered if this was a standard named algorithm and I could grab the optimal solution.
Thanks
© Stack Overflow or respective owner