Recursion Visualiser

A powerful tool designed to help developers easily visualize and debug the recursion stack, enhancing understanding and efficiency in solving complex Recursive and Dynamic programming problems.

HOW TO USE IT?


Step 0 :
Code/Paste your recursive program into the IDE below. Make the following changes to your recursive code.


Note: Do not modify any of the already written code.


Step 1 :
Add one extra parameter(let say 'ok') to your recursive and give it a default value 0.(See example image)
Just after entering the recursive function, create a string(let say 'nodeVal') which includes the function name and the values of the parameters you want to display on the nodes.

Then Insert this : tv.make(nodeVal, ok);
Don't forget to pass again the parameter 'ok' in the recursive calls.


Note: Do not make the size of the string node very large, as it will affect the appearance of the tree. Insert large intermediate values by following Step 2. This data can be viewed by hovering over the node.


Step 2 :
If your function has a return value and you want to include it in the visualization or You have to display a large value. then before returning the value, store it as:
tv.onHover(string-you-want-to-display, ok);

At last run the code by giving input(if any), a output will be generated after that click on Visualize button.

Note :
1. Right now, only C++ is supported. I will soon add support for other languages.

2. The Code execution may be slow because at each step we are using to_string() function.

3. If the online IDE is not wroking, copy the boiler-plate in any other IDE & modify the code. Generate and paste the output here and click on Visualize.

4. Consider increasing the time-limit & stack-limit of compiler you are using if output is not generated.

5. Dont add "/n" for new lines when coverting data to string. It will break the JSON. You can use defined macro br for a new line in strings.

6. You can use pre-defined functions like getVectorToString, get2DVectorToString to convert vectors to string.

EXAMPLE

Example
Example

START EXPERIMENTING

cpp
githubDark
Input:
Output:
These are some popular recursion algorithms you can implement here to visualize its recursion tree.

Connect with me :