Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Sorting algorithm

Name: Help 2011-04-15 11:56

>http://en.wikipedia.org/wiki/Quater-imaginary_base#Converting_into_quater-imaginary


ConvertToBase2i(int num) //int num is base 10
{
 int length = 1; //length of new number
 int power = 1; //origin (x^n)

 while(num < 3*(4^power)) //maximum possible value is 3 times
{
 ++length; ++power;
 if(power % 2 == 1)
   ++length; ++power;
}

int array[length]; //this will be at least large enough
int arrayValue = 0;

do{
 //**HERE**
 //Need to arrange the possible coefficeints {0,1,2,3} to get the correct answer. ([a]-[b]+[c]-[d]+[e]-...)
 //Then test those numbers:
 //for(int j = 0; j < length; ++j)
 //for(int i = 0; i < power; ++i)
  // arrayValue += array[j] * i;
}while(arrayValue != num);

string output = "";
for(int i = 0; i < power; ++i)
{
 output += array[i]; //real element
 output += "0"; //imaginary element
}

return 0;

Name: anonymous@eecs.berkeley.edu 2011-04-15 12:34

By a complete program, I mean one that I can copy, paste, and then compile. Ie, one that I don't have to enter in additional lines of code. God you suck.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List