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

# Search:

Type: Posts; User: DragForce

Page 1 of 10 1

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

by DragForce
Replies
5
Views
1,515

### 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. ## Thread: Max Cut Approximation Algorithm

by DragForce
Replies
1
Views
1,144

### 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. ## Thread: Graph problem

by DragForce
Replies
3
Views
1,074

### 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. ## Thread: Algorithms partition

by DragForce
Replies
1
Views
1,009

### Re: Algorithms partition

If n an k are reasonably small use dynamic programming. Otherwise you will need to use heuristic algorithms.
5. ## Thread: Ordered Matrix search

by DragForce
Replies
5
Views
10,088

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

by DragForce
Replies
3
Views
1,050

Here
7. ## Thread: Text In Image Recognition?

by DragForce
Replies
4
Views
1,891

### 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. ## Thread: Trying to find highest prime number but i cant get it working corectly

by DragForce
Replies
16
Views
1,638

### 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. ## Thread: Trying to find highest prime number but i cant get it working corectly

by DragForce
Replies
16
Views
1,638

### 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. ## Thread: Passing object references to classes

by DragForce
Replies
4
Views
631

### 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. ## Thread: Trying to find highest prime number but i cant get it working corectly

by DragForce
Replies
16
Views
1,638

### 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. ## Thread: Trying to find highest prime number but i cant get it working corectly

by DragForce
Replies
16
Views
1,638

### 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. ## Thread: Trying to find highest prime number but i cant get it working corectly

by DragForce
Replies
16
Views
1,638

### 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. ## Thread: defalut arguments

by DragForce
Replies
24
Views
1,795

### 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. ## Thread: references vs pointers

by DragForce
Replies
15
Views
1,683

### 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. ## Thread: Two Linked Lists

by DragForce
Replies
1
Views
917

### 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. ## Thread: POLL: Prog language for research

by DragForce
Replies
25
Views
2,703

### 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. ## Thread: references vs pointers

by DragForce
Replies
15
Views
1,683

### 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. ## Thread: What's wrong with this 'const' array decleration?

by DragForce
Replies
2
Views
593

### Re: What's wrong with this 'const' array decleration?

.h file:

#pragma once

#include <string>

class A

{
20. ## Thread: Class objects

by DragForce
Replies
2
Views
781

### Re: Class objects

Use forward declaration
21. ## Thread: Table elements compare...

by DragForce
Replies
4
Views
791

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

by DragForce
Replies
9
Views
956

Why?
23. ## Thread: linked list help!

by DragForce
Replies
9
Views
956

### 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
770

### Re: STL Qs

Look for "erase-remove" idiom
25. ## Thread: serialization

by DragForce
Replies
14
Views
1,090

### Re: serialization

See other Implementations
Results 1 to 25 of 239
Page 1 of 10 1

Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.

Featured