JavaScript is required to use Bungie.net

雜七雜八

瀏覽大量隨機討論串。
由Euler編輯: 5/15/2013 3:58:08 PM
1

Python Question - Recursion or not?

So I've got this problem that I think requires a recursive function Distilling it down - basically I'm provided with this humongous list of translations (7000+) from various languages to other languages, and a query. I'm supposed to determine the amount of languages each word in query needs to be translated to before it returns to its original language - (e.g. Bird translated to serbian is [i]ptica[/i] and [i]ptica[/i] is translated back into English as [i]Flier[/i] - a total distance of 3 languages (ENG to SER and back to ENG again), and do a bunch of stuff from there, but that's the most important bit. My only hang-up is runtime. Is it feasible to use recursion here (I've got limited runtime) or should I just stick with the iterative method? (i'm hopeless at Python if you haven't figured that out already.)

文章張貼語言:

 

以禮待人。發佈文章前請花點時間查看我們的行為準則 取消 編輯 創立火力戰隊 文章

檢視完整主題
你無權檢閱此內容
;
preload icon
preload icon
preload icon