+ 5

Do you know some interesting recursion algorithms?

I mean something more complicated than factorial or tower of hanoi? It will be nice if it has graphical results.

24th Nov 2016, 4:14 PM
Wojciech Duda
Wojciech Duda - avatar
8 Réponses
+ 11
I have it. Welcome! :)
18th Jan 2017, 4:34 AM
Sergey
+ 9
You can see my codes if you are interesting with algorithms.
16th Jan 2017, 5:14 PM
Sergey
+ 6
Hey, nikunj arora. In your program computer move taking a little time when start. Due to recursion of minimax function, it slow down your program. And decrease its time on next move. Moreover you have use setTimeout(function(){ computerMove() },100) ; It makes your program non blocking. And before completing computerMove function it execute code that takes less time in a normal sequence. If you use setTimeout(computerMove(),100) ; At first your computerMove run and save that time, but in both cases your computerMove function slow and than hide and show function below to this.
25th Nov 2016, 3:44 AM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 4
The delay is because of recursion. But When you choose player, computerMove function execute internally and when you have done with your step, it execute, and it seems that it is fast when Player take first step. But it is slow in both of cases. But you have coded a great code.
25th Nov 2016, 4:50 AM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 3
well I don't know in graphical recursion. But recursion is better for inorder,postorder,preorder tree traversal than writing a big code.
24th Nov 2016, 4:26 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 3
The minimax algorithm which is used to create an unbeatable AI for simple zero sum games, like Tic-tac-toe relies heavily on recursion. I have the code on my account. You can check it out.
24th Nov 2016, 4:30 PM
Nikunj Arora
Nikunj Arora - avatar
+ 2
thanks aditya... I added the timeout to create a realistic effect for the computer. it's working immediately when I remove it. but when the computer goes first, there is an unexpected long delay only on the first turn. the rest of the turns are working fine.
25th Nov 2016, 3:50 AM
Nikunj Arora
Nikunj Arora - avatar
+ 2
thanks for the info.. I'll try to improve it
25th Nov 2016, 5:33 AM
Nikunj Arora
Nikunj Arora - avatar