smparkes@smparkes.net
BAN USERLess than n^3 or no worse than n^3? Hungarian is n^3. Still think linear assignment is right. The graph is bipartite.
- smparkes@smparkes.net August 17, 2012? The result must be three separate connected components.
- smparkes@smparkes.net August 17, 2012The answer is correct: it's undefined. It's not about operator precedence, it's about sequence points (SP) which define whether side effects have been been guaranteed to have been performed. Since there's no SP between a++ and a, the standard says the value of the expression is undefined. Look at the Wikipedia page for sequence points. It points to the standards.
- smparkes@smparkes.net August 17, 2012Create three tasks for each school and this becomes linear assignment.
- smparkes@smparkes.net August 16, 2012Answers (including the book) that say volatile is related to threading are wrong. They're what most people think (possibly including your interviewer), but they're wrong.
Volatile was created in order to handle memory-mapped I/O. For example, the compiler is not allowed to remove redundant stores to the same address since the redundant stores may have meaning to I/O subsytems.
Volatile is neither necessary nor sufficient to handle values accessed from multiple threads.
It's not necessary because it can produce far more memory accesses than is necessary since the complier is not allowed to do much. Using, for example, pthreads you can get the consistency guarantees you need with far less memory traffic.
It's not sufficient because the standard doesn't require it. The C standard says nothing about threads. Modern CPU architectures have a very complicated memory ordering models in order to eek out performance and those models require the use of memory barrier instructions to guarantee cross-thread visibility semantics. pthreads guarantees memory barriers, volatile doesn't.
+++ lexes to ++ + because of the way lexing works, not operator precedence which is a parsing thing. And it's undefined because there is no sequence point. See the accepted answer.
- smparkes@smparkes.net August 23, 2012