Giter Club home page Giter Club logo

r-recursion.tree.visualizer's Introduction

Recursion Tree Visualizer

Tool for visualizing any generic recursive function written in JavaScript or Python.

Overview

Watch the demo video on my YouTube channel

Recursion is a concept that is best understood through visualization. This visualization tool written in TypeScript (with React and Node JS Express), will allow you to see visualization of different kinds of recursions. For simplicity, I chose to animate recursive functions using trees.

Properties of the recursion tree visualizations are:

  • Each node represents a single recursive function call.
  • The height of the recursion tree is the depth of our function call stack (n).
  • The rate of change of the tree’s width represents the time complexity of our function (m):
Image taken from QuanticDev blog post

Folders structure

  • packages/web: react user interface.
  • packages/server: server to execute user-defined code remotely.

Local development

Web

In the packages/web directory, run:

# to install all dependencies
$ npm install

# to run the app on localhost
$ npm run start

Server

In the packages/server directory, run:

# to install all dependencies
$ npm install

# to run the app on localhost
$ npm run serve

Acknowledgements

Thanks to Drawing Presentable Trees and Improving Walker's Algorithm to Run in Linear Time articles I implemented Reingold-Tilford's algorithm to position each node of the tree on a 2D plane in an aesthetically pleasing way.

Compatibility

For a better experience, I recommend using a chromium-based browser like Chrome or Edge.

r-recursion.tree.visualizer's People

Contributors

amoshnin avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.