Search:
Type: Posts; User: DragForce
Search:
Search took 0.02 seconds.

November 8th, 2006, 11:36 AM
If you need an optimal solution you basically have only two practical options: use branch and bound algorithm or dynamic programming.

November 8th, 2006, 11:31 AM
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...

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,...

If n an k are reasonably small use dynamic programming. Otherwise you will need to use heuristic algorithms.

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...


April 13th, 2006, 03:58 AM
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...

April 12th, 2006, 05:18 PM
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...

April 12th, 2006, 04:56 PM
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...

April 12th, 2006, 08:39 AM
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

April 12th, 2006, 06:45 AM
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;

April 12th, 2006, 06:00 AM
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...

April 12th, 2006, 05:33 AM
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 =...

April 11th, 2006, 08:37 AM
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...

April 11th, 2006, 06:10 AM
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...

April 11th, 2006, 05:54 AM
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

April 11th, 2006, 03:57 AM
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.

April 10th, 2006, 11:25 AM
It is considered to be good practice to pass a parameter (of not builtin types) to a function:
 by constant reference if the function is not supposed to change it
 by pointer, otherwise.
...

April 10th, 2006, 11:12 AM
.h file:
#pragma once
#include <string>
class A
{

April 10th, 2006, 11:07 AM

April 10th, 2006, 08:40 AM
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...

April 9th, 2006, 04:27 PM

April 9th, 2006, 04:23 PM
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.

April 9th, 2006, 04:18 PM
Look for "eraseremove" idiom

April 9th, 2006, 03:31 AM
See other Implementations

Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!
