Code Monkey home page Code Monkey logo

leonardonumbers's Introduction

LeonardoNumbers

This repository has the implementation of leonardo numbers, creating a tree based on leonardo numbers, creating random access array using the leonardo tree and using the iterator functions for leonardo numbers to have a fast time complexity. All are implemented in javascript.

NOTE

All answers can be found in ANSWERS.txt file

Usage

Import LeonardoNumbers

    var ln = require('./LeonardoNumbers');

Sequence number generators

Access the generators by:
ln.SequenceGenerators.[generator here]

Types of generators:

  • LeonardoNumberSolver
  • LeonardoNumberSolverNoCache
  • FibonacciNumberSolver
  • LeonardoNumberSolverDecorator

To get a number from a generator, you just have to call the get function of the instance of that generator

Example:

    var l = new ln.SequenceGenerators.LeonardoNumberSolver();
    console.log(l.get(4));

Sequence number generation via iterators

Access iterators by:
ln.LeonardoIterators.[iterator here]

Types of Iterators:

  • LeonardoNumberIterator
  • LeonardoNumberIteratorCached

Same as above, to generate a number, call get function

Example:

    var l = new ln.LeonardoIterators.LeonardoNumberIterator();
    console.log(l.get(4));

Data structures

Access data structure by:
ln.ds

Types of data structures:

  • LeonardoTree
  • LeonardoArray

Example:

    var la = new ln.ds.LeonardoArray(9);
    la.set(0, 10);
    console.log(la.get(0));
    
    var lt = new ln.ds.LeonardoTree(9);
    lt.insert(9);
    lt.insert(10);
    lt.find(10);
    lt.remove(10);

leonardonumbers's People

Contributors

geomartbrenthpabong 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.