Code Monkey home page Code Monkey logo

permutation's Introduction

permutation's People

Contributors

a-flying-potato avatar greenkeeper[bot] avatar make-github-pseudonymous-again avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar

permutation's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

bitreversal

It is possible to implement a bitreversal generator in O(n) time using half the space requirement of the bitreversal array constructor currently implemented.

A first idea is to call bitreversal( n ) which will generate an array of size n and then yield the different values of bitreversal( 2n ) from this list.

let sigma = bitreversalarray( n ) ;
for ( s of sigma ) yield s << 1 ;
for ( s of sigma ) yield s << 1 + 1 ;

A second idea is to go for a full generator implementation using a FIFO queue. Note that the recursion stack uses an additional O(log n) space.

let queue = new Queue( ) ;
for ( s of bitreversal( n ) ) yield queue.put( s << 1 ) ;
for ( let i = 0 ; i < n ; ++i ) yield queue.get( ) + 1 ;

Finally, it is possible to implement a bitreversal generator running in O(n log n) time and using O(log n) space.

for ( s of bitreversal( n ) ) yield s << 1 ;
for ( s of bitreversal( n ) ) yield s << 1 + 1 ;

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.