15,393,146 members
Home / Discussions / Algorithms

# Algorithms

 Re: Base 36 value math problem stoneyowl25-May-15 9:33 stoneyowl2 5-May-15 9:33
 Re: Base 36 value math problem Matt T Heffron6-May-15 7:49 Matt T Heffron 6-May-15 7:49
 Re: Base 36 value math problem Daniel Pfeffer6-May-15 21:21 Daniel Pfeffer 6-May-15 21:21
 Re: Base 36 value math problem Gerry Schmitz5-May-15 9:53 Gerry Schmitz 5-May-15 9:53
 Re: Base 36 value math problem stoneyowl25-May-15 9:58 stoneyowl2 5-May-15 9:58
 Re: Base 36 value math problem Gerry Schmitz5-May-15 10:15 Gerry Schmitz 5-May-15 10:15
 Re: Base 36 value math problem Patrice T17-Jun-15 19:00 Patrice T 17-Jun-15 19:00
 Re: Base 36 value math problem Frankie-C6-May-15 7:01 Frankie-C 6-May-15 7:01
 A base 36 numbering scheme should be the math rappresentation of a normal numer expressed with 36 different ciphers. It should be quite an easy task to create a function that converts the strings that you have to plain binary numbers (base 2) understandable to the computer. This function is equivalent to an ascii to bin conversion, only the symbols that have top be handled are 36. The sequence, I suppose, is: 0 1 2 3 4 5 6 7 8 9 A B C D E F G . . . . . Z The generic rappresentation of a number expressed in base x is: Vn*X^n + V(n-1)*X^n-1 + V(n-2)*X^n-2 + ... + V(0) In plain the sum of all ciphers by the power of the base at the position taken as exponent. This is sample to convert a base 36 number to a base 2 numberEDIT: This sample converts any ascii rappresentation of a number in all bases between 2 and 36. It acts as the standard atoi, atol, etc. It converts all applicable characters up to the end of string or the first non number with respect to the choosed base. If the first string char is not a valid cipher, or the string is empty it returns NULL. C++Copy Code ```long long GenRadVal(char *str, int base) { if (base<2 || base>36) return 0LL; long long val = 0; for (int i = 0; str[i]; i++) { int c = toupper(str[i]); if ((c < 0) || ((c > '9') && (c < 'A')) || (c > 'Z')) break; c = c > '9' ? c - 'A' + 10 : c - '0'; if (c >= base) break; val *= base; val += c; } return val; }``` This will give you back a 64 bits number equivalent to the string. To go back to the original value you can use itoa() function in C. Now comparisons are easy.. P.S. the reverse for this function is the stdlib function itoa() with base=36.modified 17-May-15 12:01pm.
 Re: Base 36 value math problem Matt T Heffron6-May-15 7:41 Matt T Heffron 6-May-15 7:41
 Re: Base 36 value math problem Frankie-C7-May-15 2:07 Frankie-C 7-May-15 2:07
 Re: Base 36 value math problem Patrice T17-Jun-15 18:37 Patrice T 17-Jun-15 18:37
 Re: how does C4.5 work? PIEBALDconsult25-Apr-15 7:46 PIEBALDconsult 25-Apr-15 7:46
 Re: how does C4.5 work? pt140125-Apr-15 8:39 pt1401 25-Apr-15 8:39
 Re: how does C4.5 work? Richard MacCutchan25-Apr-15 20:54 Richard MacCutchan 25-Apr-15 20:54
 Re: how does C4.5 work? Kornfeld Eliyahu Peter25-Apr-15 21:01 Kornfeld Eliyahu Peter 25-Apr-15 21:01
 Re: algorithm Sascha Lefèvre25-Apr-15 7:37 Sascha Lefèvre 25-Apr-15 7:37
 algorithm Deepak Pundir17-Apr-15 9:10 Deepak Pundir 17-Apr-15 9:10
 Re: algorithm Sascha Lefèvre17-Apr-15 9:48 Sascha Lefèvre 17-Apr-15 9:48
 Re: algorithm harold aptroot17-Apr-15 9:54 harold aptroot 17-Apr-15 9:54
 Re: algorithm PIEBALDconsult15-May-15 14:42 PIEBALDconsult 15-May-15 14:42
 Algorithm for finding the best “route” of tasks Nino Cotec2-Apr-15 5:50 Nino Cotec 2-Apr-15 5:50
 Re: Algorithm for finding the best “route” of tasks Chris Losinger2-Apr-15 9:41 Chris Losinger 2-Apr-15 9:41
 Re: Algorithm for finding the best “route” of tasks Patrice T25-Jun-15 8:44 Patrice T 25-Jun-15 8:44
 Create continuous path from multiple segments Member 115731191-Apr-15 3:38 Member 11573119 1-Apr-15 3:38
 Re: Create continuous path from multiple segments Frankie-C2-Apr-15 1:27 Frankie-C 2-Apr-15 1:27
 Last Visit: 31-Dec-99 18:00     Last Update: 11-Aug-22 20:23 Refresh ᐊ Prev1...44454647484950515253 Next ᐅ

General    News    Suggestion    Question    Bug    Answer    Joke    Praise    Rant    Admin

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.