Skip to content

Instantly share code, notes, and snippets.

@garrettgsb
Created July 11, 2016 04:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garrettgsb/88986ca5cf8c8e5e496e0b049157caa4 to your computer and use it in GitHub Desktop.
Save garrettgsb/88986ca5cf8c8e5e496e0b049157caa4 to your computer and use it in GitHub Desktop.
NotFizzBuzz
contract NotFizzBuzz {
//By Garrett B
function selectionSort(uint[] x) returns (uint[]){
uint length = x.length;
for (var i = 0; i < length-1; i++) {
for (var j = i; j < length; j++) {
if (x[i] > x[j]) {
uint a = x[i];
uint b = x[j];
x[i] = b;
x[j] = a;
}
}
}
return x;
}
function factorial(uint x) returns (uint) {
if (x - 1 > 0) {
x = x * factorial(x - 1);
}
return x;
}
function sqrt(uint x) returns (uint) {
for (uint i = 0; i*i <= x; i += 1) {
uint a=i;
}
return a;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment