CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: DragForce

Page 1 of 10 1 2 3 4

Search: Search took 0.03 seconds.

  1. Re: Given N elements, find best permutation closest to Σ

    If you need an optimal solution you basically have only two practical options: use branch and bound algorithm or dynamic programming.
  2. Replies
    1
    Views
    1,285

    Re: Max Cut Approximation Algorithm

    Normally, if one can't provide an optimal algorithm for a problem but still wants to evaluate the quality of a proposed heuristic algorithm the following method is used:

    Define some upper bound...
  3. Replies
    3
    Views
    1,176

    Re: Graph problem

    Have a look at algorithms for solving Minimum Cut problem. You may also note that a graph may be transformed in the following way: every edge of the original graph becomes a vertex of a new graph,...
  4. Replies
    1
    Views
    1,036

    Re: Algorithms partition

    If n an k are reasonably small use dynamic programming. Otherwise you will need to use heuristic algorithms.
  5. Replies
    5
    Views
    10,271

    Re: Ordered Matrix search

    First do binary search for diagonal elements. If the required element is not there, then you will know row and column which may contain it. Do binary search for both of them. The complexity wil be...
  6. Replies
    3
    Views
    1,192

    Re: Data Structure with 3 keys

    Here
  7. Replies
    4
    Views
    2,004

    Re: Text In Image Recognition?

    Once I did a similar thing to automatically pass registration process on one internet site. In many cases it is trivial to do.

    1. Ideally you would know in advance a certain characteristic of the...
  8. Re: Trying to find highest prime number but i cant get it working corectly

    I am sorry about my misunderstanding of your previous post.

    And I am completely agree with your critique of my algorithm. I was a bit too defensive :blush: . You are rigth. Anyway that algorithm...
  9. Re: Trying to find highest prime number but i cant get it working corectly

    Sorry about that typo. I really meant using "/" rather than "%".


    I am afraid to say but you misunderstand the notion of computational complexity.

    Computational complexity is calculated...
  10. Replies
    4
    Views
    750

    Re: Passing object references to classes

    If you know what your are doing, if you sure that your design is right, if you considered the lifetime of all created objects, then it is Ok
  11. Re: Trying to find highest prime number but i cant get it working corectly

    I am not sure that full decomposition is as fast as this check:



    int get_lagest_blah_blah( int a ){

    for (int i = a%2; i > 1; --i)
    {
    if (((a%i)==0) && (isPrime(i)))
    return i;
  12. Re: Trying to find highest prime number but i cant get it working corectly

    Let N be the value of you parameter. So the size of input is M= log N - the length of input (its binary representation).

    Yours version makes ~N divisions and comparisons, which is equivalent to...
  13. Re: Trying to find highest prime number but i cant get it working corectly

    isPrime function works but it is written in, probably, the most inefficient way. Try using something like that



    bool isPrime ( int a ){
    if (a < 2)
    return false;

    int sqrt_a =...
  14. Replies
    24
    Views
    2,493

    Re: defalut arguments

    To avoid problems with ambiguity. Suppose you have function of 5 integer arguments and second and forth are optional. In the program this function is caleed with 4 parameters. How can compiler find...
  15. Replies
    15
    Views
    2,733

    Re: references vs pointers

    Sorry, I am not following it. Why do you think so?


    Passing parameter by const reference is almost equivalent to passing it by value, so when one looks at such a call it is clear enough what is...
  16. Replies
    1
    Views
    1,075

    Re: Two Linked Lists

    From the definition of a list configuration "X" may not exist. For a solution look in this forum. This task has been discussed already.

    Here
  17. Replies
    25
    Views
    2,974

    Poll: Re: POLL: Prog language for research

    Fortran still delivers fastest libraries and it is widely used among researchers. In fact in the research groups which I know very well the proportion Fortran to C++ is 4 to 2.
  18. Replies
    15
    Views
    2,733

    Re: references vs pointers

    It is considered to be good practice to pass a parameter (of not built-in types) to a function:

    - by constant reference if the function is not supposed to change it

    - by pointer, otherwise.
    ...
  19. Re: What's wrong with this 'const' array decleration?

    .h file:


    #pragma once

    #include <string>

    class A

    {
  20. Replies
    2
    Views
    1,157

    Re: Class objects

    Use forward declaration
  21. Replies
    4
    Views
    858

    Re: Table elements compare...

    Based on your question I assume that you don't care about the computational complexity. So you can go for the simplest algorithm.

    First of all define function IsDominated(i, j), which returns...
  22. Replies
    9
    Views
    1,386

    Re: linked list help!

    Why?
  23. Replies
    9
    Views
    1,386

    Re: linked list help!

    Copy elements of your linked list into an array, sort it and form a new list of that array. This is the most effective algorithm in such a situation.
  24. Thread: STL Qs

    by DragForce
    Replies
    2
    Views
    1,094

    Re: STL Qs

    Look for "erase-remove" idiom
  25. Replies
    14
    Views
    1,505

    Re: serialization

    See other Implementations
Results 1 to 25 of 239
Page 1 of 10 1 2 3 4





Click Here to Expand Forum to Full Width

Featured