Git Product home page Git Product logo

ddsnowboard / javaprojects Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 14.88 MB

Random project in any language (don't let the name fool you) that don't fit into another repo. Usually Project Euler or K&R exercises, but anything that pops into mind

C 7.61% C++ 1.91% JavaScript 33.06% Java 3.16% Python 2.62% Makefile 0.43% Shell 0.01% Racket 0.50% Ruby 0.49% PHP 0.31% Rust 8.64% Scheme 0.07% C# 0.36% HTML 1.58% CSS 0.51% TypeScript 0.88% Haskell 0.47% Go 0.46% TeX 36.76% Elm 0.18%

javaprojects's People

Contributors

ddsnowboard avatar

Watchers

 avatar  avatar

javaprojects's Issues

Optimize Euler50

So, my plan is to implement some memoization. I mentioned it in b51ba60, but I didn't put any details, and that's because I don't really have too many that I can articulate. I know that there should be a way to make an associative array that has primes as keys and lists of primes that sum to them (or maybe just the index of the first and last ones) as values. Getting this is not too clear though. I could do it dynamically, which would mean that every time there could be one, I check, and if there is, I load it and move on, and if it isn't, I remember that, calculate it manually, and put it in after. Or, and this is becoming more appealing in my mind as time goes on, I could do it at the beginning and then just use it later. This would mean that I would go through all the possible sequences and then put them in an array. Something kinda like this (kinda sorta pseudocode)

for i = 0 to BIGGEST_PRIME_INDEX
    for j = i to BIGGEST_PRIME_INDEX
        // if the sum of all those numbers is prime... 
            // (This line is Python)
            memo[sum([primes[m] for m in range(i, j)])] = Pair(i, j) 

This would create a huge array, memo, with all the numbers in it and how to get their sum. So I could generate all the primes, which isn't too fast, but I think would take not forever and would have a time complexity less than O(n^2) I think, and then do this, which would also be kinda slow, but would also scale better, and then I run through the array and find the biggest difference in the pair. This could work.

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.