Search:

Type: Posts; User: R.Stiltskin

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. Take a close look at the end of line 9.

    Take a close look at the end of line 9.
  2. Thread: Basic MPI

    by R.Stiltskin
    Replies
    7
    Views
    2,011

    Seems wasteful to divide each number by 4,6,8 ...

    Seems wasteful to divide each number by 4,6,8 ...
  3. Replies
    24
    Views
    2,912

    Read your error message. Why do you think that...

    Read your error message.

    Why do you think that static const double d = 2.0; isn't valid? d = 2.0 is a constant expression so it's allowed in the class definition.
    [edit: forgot that this is a...
  4. Replies
    2
    Views
    860

    Think about what you're doing here: ...

    Think about what you're doing here:


    for(int i = 0; i < index; i++){
    prevNode = newNode;
    newNode = newNode->next;
    }

    Suppose for example that the index value is 10. How useful...
  5. Replies
    6
    Views
    905

    Do you have a question? You have a variable...

    Do you have a question?

    You have a variable called prevNode. So what is p for?
    Where should prevNode point to start iterating through the list?
  6. Replies
    4
    Views
    1,340

    I think the operative words there were "Aren't...

    I think the operative words there were "Aren't you supposed ..."

    Start at the head of the list.
  7. Replies
    4
    Views
    1,340

    Aren't you supposed to find a position in the...

    Aren't you supposed to find a position in the list that's passed into the function?
  8. Replies
    69
    Views
    8,501

    In the worst case, it's still O(n2). You would...

    In the worst case, it's still O(n2).

    You would do better to go back to your compact function in post #61 and make it in-place by simplifying it, rather than by complicating it. Essentially all...
  9. Replies
    69
    Views
    8,501

    Still working on this, I see. I was hoping that...

    Still working on this, I see. I was hoping that by the time you finished implementing the step-counting you would have realized how simply (and efficiently) you could complete the assignment with...
  10. Replies
    69
    Views
    8,501

    Nice job. Now why don't you modify the program...

    Nice job. Now why don't you modify the program so it counts (and prints) the number of assignments performed (i.e., how many times a number is moved from one place to another) while processing a...
  11. Replies
    69
    Views
    8,501

    We shouldn't turn this into a debate about...

    We shouldn't turn this into a debate about complexity, but doesn't repeatedly shifting the entire array change it from O(n) to O(n2)?

    But even ignoring the time complexity, it makes the program...
  12. Replies
    69
    Views
    8,501

    That's a viable approach and certainly worth...

    That's a viable approach and certainly worth doing, if only for the benefit of the programming practice it gives you. However, think about how many operations the computer will be performing as...
  13. Replies
    69
    Views
    8,501

    Of course it's solvable. Think.

    Of course it's solvable. Think.
  14. Replies
    69
    Views
    8,501

    Are you sure you want to compare to element...

    Are you sure you want to compare to element [i-1]?

    PS: when you see entries like 2686632 popping up, you should suspect that you might be running out of the bounds of your array somewhere.
  15. Replies
    38
    Views
    10,286

    I'm sure your problem has nothing to do with the...

    I'm sure your problem has nothing to do with the name-related code.

    You must be using some archaic compiler. I can't even compile that code, and after I make the changes necessary to get it to...
  16. Replies
    38
    Views
    10,286

    edit: Good timing. I'll take a look at it.

    edit: Good timing. I'll take a look at it.
  17. Replies
    38
    Views
    10,286

    Parameters are values that are passed from one...

    Parameters are values that are passed from one function to another. In the case of the char* pointer, the value that's being passed is the address of a char variable. This variable (in this case...
  18. Replies
    38
    Views
    10,286

    Instead of declaring user in that function, pass...

    Instead of declaring user in that function, pass user as a parameter to the function. It's also a good idea to pass the size of the array as another parameter, and use fgets instead of gets to...
  19. I don't have a Windows machine handy to test...

    I don't have a Windows machine handy to test with, but where did you ever read any mention of a "namespace cv"? And where did you find "cv.hpp"?

    Try


    #include <cv.h>
    #include <cxcore.h>...
  20. Replies
    7
    Views
    1,868

    It's hard to tell what your problem is from the...

    It's hard to tell what your problem is from the little code you posted, but maybe this will help:



    include <iostream>
    #include <string>
    using namespace std;

    class A {
  21. Replies
    11
    Views
    4,177

    The usual way in C is to use sprintf...

    The usual way in C is to use sprintf which works basically the same as printf except it writes to a string instead of to the console.
  22. Replies
    11
    Views
    4,177

    You're treating your jpeg data as if it were a...

    You're treating your jpeg data as if it were a string -- but it's not. A string is a null-terminated char array. When you use strlen(data) to pass the size of the array to fwrite, you are measuring...
  23. Replies
    5
    Views
    1,629

    #pragma once does basically the same thing as...

    #pragma once does basically the same thing as include guards, except that it is non-standard, i.e. is only supported by specific compilers.
  24. Replies
    5
    Views
    1,435

    Or if you insist: wDeck[i].color = i/26; ...

    Or if you insist:


    wDeck[i].color = i/26;

    will give 0 when i is less than 26 (hearts & diamonds) and 1 otherwise.
  25. Replies
    5
    Views
    1,435

    Think again about the sequences generated by your...

    Think again about the sequences generated by your fillDeck function:


    a 2 3 4 5 6 7 8 9 10 j q k a 2 ...
    h h h h h h h h h h h h h d d ...
    b r b r b r b r b r b r b r b ...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4