Search:

Type: Posts; User: jack_carver

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    1,225

    If compile time i am guessing we would have to...

    If compile time i am guessing we would have to use conditional compilation.
    How about runtime ?
  2. Replies
    3
    Views
    1,225

    C++ Error Checking

    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...
  3. Replies
    2
    Views
    2,405

    Thank you.

    Thank you.
  4. Replies
    2
    Views
    2,405

    Parenthesis operator overload

    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...
  5. Replies
    3
    Views
    2,425

    Re

    Adding an allocator parameter removes the error



    containerType < int,allocator<int> > intC;


    But is there anyway to avoid or make it default or something ?
  6. Replies
    3
    Views
    2,425

    template C++

    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>...
  7. Replies
    7
    Views
    3,791

    Re

    @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...
  8. Replies
    7
    Views
    3,791

    Thanks

    @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...
  9. Replies
    7
    Views
    3,791

    Sieve of Eratosthenes

    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 ~...
  10. Thread: Modulo 12

    by jack_carver
    Replies
    12
    Views
    3,754

    Modulo 12

    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
  11. Replies
    4
    Views
    1,828

    scanf("%d",&n); vector< pair >...

    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...
  12. Replies
    4
    Views
    1,828

    increasing sequences

    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] ,...
  13. Replies
    4
    Views
    1,089

    Thanks

    Thank you :)
  14. Replies
    4
    Views
    1,089

    Complete list of functions

    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...
  15. Replies
    2
    Views
    1,696

    Implementing divison for bignum ?

    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...
  16. Thread: #define

    by jack_carver
    Replies
    2
    Views
    1,214

    thanks

    Thanks a lot
  17. Thread: #define

    by jack_carver
    Replies
    2
    Views
    1,214

    #define

    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...
  18. Replies
    5
    Views
    3,198

    Test cases

    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
  19. Replies
    5
    Views
    3,198

    Collision detection

    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 ,...
  20. Replies
    0
    Views
    811

    Improvements

    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...
  21. Replies
    2
    Views
    6,232

    Determinant

    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 ?
  22. Replies
    13
    Views
    1,662

    struct vs class

    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 ...
  23. Replies
    2
    Views
    3,111

    Re

    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...
  24. Replies
    2
    Views
    3,111

    Discrete Math

    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 +...
  25. Replies
    2
    Views
    2,189

    Custom format specifiers ???

    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 :
Results 1 to 25 of 71
Page 1 of 3 1 2 3