亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

算法 - 用代碼獲取流程走向(Java)
天蓬老師
天蓬老師 2017-04-18 10:52:54
0
2
628

需求是這樣的,有很多類似的流程如下:

有一個函數(shù),我傳入一個開始節(jié)點Node,能夠獲取所有的流程走向,包裝List返回,比如上面這張圖就有兩種走向:通過和不通過。我開始用遞歸來做,類似這樣:

測試了幾個流程,確實能達到效果,但是一遇到復雜的流程(上百種走向)的時候,

遞歸就會有性能問題(棧溢出等)
請問各位大神,像這種情況除了遞歸還有什么解法嗎?如果沒有,這種遞歸有哪里可以優(yōu)化的地方?小弟能力有限,想了幾天沒啥好辦法....

天蓬老師
天蓬老師

歡迎選擇我的課程,讓我們一起見證您的進步~~

reply all(2)
阿神
  1. The problem is recursive, and recursion is not necessary for implementation. You can put "Node that has not yet been searched" into a List. Each time a new Node is found, it is placed at the end of the List. When the next round of search starts, it is taken from the end of the List.

  2. Dynamic programming should also be used to reduce repeated searches. This problem is NP in complete search.

迷茫

Is this a workflow? ? ? ?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template