cs371p-collatz's People
cs371p-collatz's Issues
Unit Tests
Created at least 3 Unit tests for each of the functions.
Documentation
Used Doxygen to document the project.
Cache won't work with a very high number of entries.
Made it work with 1,000,000 entries.
Not passing V2 of the sphere collatz problem
Changed the boolean variable 'hit' to become false after being true, then it worked!
Implementation
Implemented all of the requirements and the project runs as expected.
Improved speed
Changed from:
n = (3 * n) + 1;
to:
n = n + (n >> 1) + 1;
Issue Tracker
Counting this one, there is a total of 18 issues.
Sphere
Sphere accepted solutions to both the required and extra-credit solutions.
Check to see if i is more than j
Updated code to see if i is more than j; if it is, swap them.
Still too slow
Made it dramatically faster by adding:
Let m = e / 2.
If b < m, then max_cycle_length(b, e) = max_cycle_length(m, e)
Acceptance tests
Used Python script to create the 1000 Acceptance tests.
Pushed the tests to the public test repository.
Not passing a test case
Was not passing another user's test case; got it resolved.
error: ‘cache’ was not declared in this scope
Had:
int idx = 1000000;
int cache[idx] = {0};
This is what gave me the error; these were both global variables used inside the function collatz_eval.
After, I changed the code to:
int cache[1000000] = {0};
with no index variable, the algorithm worked without problems.
More than 10000000 total errors detected
Was getting more than 1 million memory errors because I was creating an array of 1 million entries every time the function collatz_eval was called.
Instead I made the array a global variable; it solved the problem and increased the efficiency dramatically.
Finished project
Finished with the project; sphere accepts both solutions.
Git repository
Created a new private repository for the Collatz project.
Implement cache
Implemented a lazy cache.
Submission
Submitted collatz-project.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.