Giter Site home page Giter Site logo

apache-age's Introduction

Fibonacci Sequence with Dynamic Programming

This project implements a Fibonacci sequence using Dynamic Programming with the ability to perform arithmetic operations (+, -, *, /) and conditions.

Development Environment

  • Node.js: v14.x or above
  • npm: v6.x or above

How to Run

  1. Clone or download this repository to your local machine.

  2. Open a terminal or command prompt and navigate to the project directory.

  3. Install the required dependencies using npm:

npm install

  1. Run the JavaScript program:

node fibonacci.js

Usage

Modify the main() function in the fibonacci.js file to change the arithmetic expressions and conditions and calculate different results.

In the main() section of fibonacci.js, use the makeFunc function to define arithmetic expressions and conditions. The makeFunc function takes two arguments, the first argument being the type of operation (e.g., "ADD", "MUL", "SUB"), and the second and third arguments being the operands.

For example, to create an addition operation of 10 and 6:

const add = makeFunc("ADD")(10, 6);

To create a multiplication operation of 5 and 4:
const mul = makeFunc("MUL")(5, 4);

To create a subtraction operation using the previously defined mul and add operations:
const sub = makeFunc("SUB")(mul, add);

To create a Fibonacci sequence calculation using the sub operation:
const fibo = makeFunc("FIBO")(sub, null);

Save the changes to fibonacci.js, and run the program again using the command:

node fibonacci.js

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.