Search:
Type: Posts; User: Zachm
Search:
Search took 0.03 seconds.

September 7th, 2011, 02:48 PM
This is in fact a clustering problem  you wish to cluster n airports to gi groups where each group centroid is a gas station coordinate.
Simplest (but maybe not best) method is to use the Kmeans...

See here:
"Lists have the important property that insertion and splicing do not invalidate iterators to list elements, and that even removal invalidates only the iterators that point to the...

If you *KNOW* there are exactly n/2 1's and n/2 2's, then why sort ?
Go over the array and assign 1 to the first n/2 elements and 2 for the rest.
Exactly n assignments and no need for comparison......

Basically you are rearranging each of the matrices rows according to the sorted ordering of a given column in a given matrix.
You just need to figure out what is the new row index of each of the...

April 25th, 2011, 11:21 PM
Mathematica is also a good option, in my experience.
Regards,
Zachm

March 16th, 2011, 02:56 PM
Computationally speaking, just emulating the program run and counting the number of steps is not so hard  but if a program with finite runtime may still run for a VERY long time depending on the...

March 13th, 2011, 05:30 AM
Seems to me that a ternary tree could be used the same way as a binary tree is used  by, for example, ignoring the rightmost child (keeping it NULL) of each node, and considering the leftmost and...

March 12th, 2011, 02:14 PM
As I remember, the number of moves required is (2^n)  1,
anyhow, this number is Theta(2^n) if and only if it's O(2^n) and also Omega(2^n).
Go back to the mathematical definition of the bigOh...

March 7th, 2011, 12:04 AM
You can use [ code ] tags to wrap around your code  '#' icon in rich edit mode.
The reason your code goes into an infinite loop is that the for loop exit condition is that i > 255 (since if i <=...

March 6th, 2011, 11:55 PM
Well, that's how cin works.
Good idea! (except for the 'but that seems too complicated' part :)).
If you try doing as you suggested, maybe it won't seem so complicated.
Regards,
Zachm

March 5th, 2011, 11:51 PM
To find the ratio between your "world" coordinate units to the cost/heuristic function units, just look at the distance cost between 2 adjacent points relative to the "coordinate" distance between...

February 28th, 2011, 02:20 AM
This is because this is not C++ or C code at all. This is bison(or yacc) BNF input format.
Maybe this yacc calculator example will prove handy ?
I am absolutely *not* the master of bison(or yacc),...

February 9th, 2011, 10:51 PM

February 9th, 2011, 03:49 AM
Radix Sort can give you runtime complexity of O(n).
Regards,
Zachm

February 7th, 2011, 12:43 AM
Do you want to find two numbers X, Y, where X is a number from the first array and Y is a number from the second, such that X + Y = S, and S is some predefined value ?
Are the arrays sorted ?
...

February 6th, 2011, 11:57 PM
Or you can do this:
#include <stdio.h>
main(int t,char _,char *a)
{
return!0<t ? t<3 ? main(79,13,a+main(87,1_,main(86, 0, a+1 )+a)):1,t<_?main(t+1, _, a ):3,main ( 94, 27+t, a )&&t==...

February 6th, 2011, 07:15 AM
bool Mob::checkLeader(Mob* L)
{
if(leader != NULL) //leader exists
{
if(leader != L) //leader is not me
{
if(checkLeader(L)) ...

January 30th, 2011, 06:57 AM
Yes, it is.
Think about how you can sum the value of a path starting at index i, given the sum of the path starting at index i1, in O(1):
161 = 97 + 32 + 32
164 = 32 + 32 + 100
164 = 161  97...

January 28th, 2011, 05:28 AM
This makes it even simpler.
You can think of your segment as having only ranges which are 1 unit in length by dividing each range with weight w of x units length to x ranges with weight w each.
...

January 23rd, 2011, 11:40 AM
This seems like a rather straight forward problem, though some optimizations come to my mind. There exists an O(n) algorithm to solve this problem, where n is the total number of units.
What did...

November 21st, 2010, 01:22 AM
In general, you can use the Flood Fill algorithm in order to find all pixels with the same color, starting from a given pixel.
But what will you do if you have two different circles which are...

November 11th, 2010, 08:40 AM
Hi,
I'm interested.
I have 5 years of commercial development experience in both C++ and C#.
You can PM me if this is still relevant and we will close the details (I couldn't PM you since you...

October 31st, 2010, 02:26 AM
If I put code lines which does the majority of the computation in your example code, it would be the following lines:
cornerSlope = (ymax  p1y) / (xmin  p1x); //in clipEnd()
...
...

October 27th, 2010, 01:53 AM
If we're going for an overkill, there are many funny ways of doing stuff ;).
For instance, this some what odd way of approximating Pi :
#include <stdio.h>
#define _ F>00  FOO;
long...

October 24th, 2010, 12:35 PM
I don't think this case is possible since the clique is maximum:
Assume there is some vertex v in the IS which is connected to all vertices of the clique, it follows that degree(v) >= m and...

Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.
Featured
