I think algorithm contests are good for interview preparation and for fun.
Type: Posts; User: SilentStrike
I think algorithm contests are good for interview preparation and for fun.
I work in the US as a software engineer.
The cultures really are that different. I have a German coworker; he is constantly surprised by the amount of personal information employers gather. For...
My university offered both a BA and a BS in computer science. The BS was strictly harder to get, it had more requirements. If you want to go far in academia in Computer Science (IE, getting a phd),...
If you can factor a number that large, these guys will probably pay you quite handsomely.
Mostly, you have a problem with off by 1s.
Your biggest mistake is here
Perm(a,k+1,n-1);
In particular, you are decreasing n each recursive call, but n itself is supposed to be the...
The entropy is p1 log2 (1/ pi) + p2 log2 (1 / p2) + p3 log2 (1 / p3) .. p14 log (1 / p14). The entropy is maximized when all the probabilities are equally likely, so all are 1/14, in which case the...
The only generate code at runtime thing I have ever seen is for this..
http://www.transgaming.com/index.php?module=ContentExpress&file=index&func=display&ceid=8
Maybe your professor is just bad? Do you have any specific questions?
Do you mean http://acm.uva.es?
This is my account http://acm.uva.es/problemset/usersjudge.php?user=46682
You should install it. It's really a great game. Perhaps it is even the best open source game availible.
You could just apt-get install it, though I guess the version you get is too old.
I am running Ubuntu 5.10, libsdl version 1.2.8 (installed either by default or via apt-get).
rob:/etc$ cat...
The comma in the if is really odd.
Instead of
while (cin >> ival, !cin.eof()) {
Did you mean
The warning is not because you are derefencing the character, but rather because toupper returns an int.
http://www.sensi.org/~alec/man/man3/toupper.html
If you want to see how to actually manipulate the data using iterators, check out this code, which uppercases input text line by line.
The problem with your code is that you were making a...
I recommend you first write a context free grammar for the expressions you want to accept. After you have your grammar, you can usually turn it into a recursive descent parser fairly easily.
...
For the following problem, a sorted vector will be faster than an STL map (or STL set, use the same structure internally) as well.
Given a list of words, and then a list of queries, determine...
Your way seems fine.
Conventially, if you want to count from 0 to 99 in C or C++, one writes
for (int i = 0; i < 100; ++i)
instead of
for (int i = 0; i <= 99; ++i)
By implement properly, I mean that you should probably just copy the string data.
Alternatively, just use an stl string (from <string>) rather than your Key class (if allowed), as it looks like...
I don't know if this will fix your crashing, but I think you want to take a reference to a key rather than a key in your BST(key) constructor. Also, your Key class copy constructor should be...
I think your problem is that it's not.
Experimentally...
i, p(i), p(i)/p(i-1)
>>> for i in range(2, 40): print i, p(i), float(p(i)) / p(i - 1)
...
If you represent the graph in that fashion without any augmenting data structures, your addEdge method will be slow. You need to rethink the data structure if you want it to be efficient.
I don't actually understand how your representation of the edge_matrix can work. What does edge_matrix[i][j] == true mean? What do i and j represent? The i'th and j'th verticies? It seems you...
It seems to me that you want to solve a problem like this?
http://acm.uva.es/p/v1/123.html
I don't see how rotating your strings really helps you. I solved that problem using a fairly advanced...
Actually, I'd say these people are MUCH smarter than me, and probably a bit smarter than you. They are squeezing seconds off of coding time, not running time.
Take a look at this, for example...