If compile time i am guessing we would have to use conditional compilation.
How about runtime ?
Type: Posts; User: jack_carver
If compile time i am guessing we would have to use conditional compilation.
How about runtime ?
Hello
I want to implement a class and say for each of the method I add code for error checking (bounds,correct args etc..) However I do want the provide user with an option to disable error checking...
Thank you.
I was trying to implement a simple matrix class below is its code. Can any one tell me why the the print statement "CALLED CONST" isn't getting executed ? It was supposed to get printed while...
Adding an allocator parameter removes the error
containerType < int,allocator<int> > intC;
But is there anyway to avoid or make it default or something ?
I was reading about "template template parameters" and when i try this code out it results in compiler error, can anyone help me out ?
#include <cstdio>
#include <list>
#include <vector>...
@iMalc:
I tried declaring them as unsigned and also used a macro .. still doesn't speed up ...
So i can only assume that the compiler is already doing such optimizations. Are there any nice...
@vart
Thanks a lot .. that was neat .
@iMalc ..
I added ur suggestion but it surprisingly it takes longer than my earlier .. any idea what wrong with my implementation ?
All the required...
Hello
Below is a working code for the sieve .. it has the wheel 23 optimization i.,e all multiples of 2 and 3 are directly ignored (not stored at all). It generates primes upto 10^8 in around ~...
Hi
Is there any way to do the modulo 12 operation (i.e, n%12 ) in a faster way (other than the obvious n%12 way ?
I am implementing sieve of atkin so need to speed it up :)
Thanks a lot
scanf("%d",&n);
vector< pair<int,int> > sorted;
for(int i=0;i<n;i++)
{
scanf("%d",&num);
sorted.PB( make_pair(num,i) );
}
sort(sorted.begin(),sorted.end());
int...
Does any 1 know an easy way to count the number of increasing sequences in an array ?
ex: 1 5 2 6 3 7 4 8
ans is 2 -> [1,2,3,4] , [5,6,7,8]
ex: 1 3 5 2 4 6
ans is 3 -> [1,2] , [3,4] ,...
Thank you :)
Hi ..
Is there any place where i could get a COMPLETE list of functions in "math.h" or any other header file for that matter ?
And i mean COMPLETE :) .. for example today i found out that math.h...
Hi..
Can any 1 help me in figuring out how to implement division for arbitrary sized integers ?
I have implemented + , - , * operators..
i am unable to figure out how to implement long...
Thanks a lot
Hi
i have 4 expressions ( each of them have only one arithmetical operator (+,-,*,/) )
a>b?a+b:b+a
a>b?a-b:b-a
a>b?a*b:b*a
a>b?a/b:b/a
Is there any way to write a general macro for this...
I've come up with a function that seems to be working .. . Is there any way to test it .. is there any standard library available ? or a list of test cases probably ?
Thanks
Hello..
I need to implement a fast function for detecting collision between a square and circle ... it is also given that square is also axis(X-Y) aligned ..
The center of the circle , square ,...
Hello..
Below is my implementation of a max heap ..
I'd be grateful if any one can suggest any improvements .. or any better ways to implement
Thanks a lot !
#include <cstdio>
#include...
Is there any way to compute the determinant % N using gaussian elim
Since while we are reducing the rows the other elements are forced to become fractions :(
Is there any way around this ?
I am quoting this from a book (C# 3.0 O'reilly.. pg 160 )
"The goal struct is to be lightweight - requiring little memory overhead ....etc... "
Is the true for C++ also ?? If yes .. Can ...
I dont know what u meant but this is my current code
#include <cstdio>
#include <cstring>
using namespace std;
bool mod(const char *str,int num) //check if str%num==0
{
int...
I know that this isn't a math forum .. but i have always found help here so i am posting something again :)
Given:
N , M , K , gcd(a,b)=1
N,M can be written as
N = a + b
M = a^2 +...
Is it possible to make our own format specifiers ??
data type can be redefined either using typedef or #define
#define LL long long
typedef long long LL ;
but what about this :