Maps are one of the most useful datastructures in C++ and there is no excuse for not knowing it. Here is a basic example that shows how you can use it: See also C++ Reference: general information and example Map is ordered collection (source)
Posts Tagged ‘C’
How do hash functions work?
Everybody who has written a noticeable amount of Java code should know the method hashCode(). But most beginners have difficulties to understand the significance of this little method. The following article gives you one small example with some impressions how much hash functions influence execution time. Connect four Connect Four [...] is a two-player game [...]
Google Code Jam Templates
Here are some templates that are a good start for Google Code Jam. C++ Compile Execute Python Input: input, raw_input() String parsing: strip(), split() Execute Java This is an ajusted version of mystics solution for “Dancing with Googlers”. You might want to take a look at Scanner and PrintWriter. Adjust the path and execute it [...]
What does volatile mean?
You might have read the variable modifier volatile in C, C++ or in Java. But do you know what it means? C Programming Language The C Programming language by Kerninghan and Ritchie (second edition) contains this keyword only 13 times. Here are the most important ones: [...] declaring it volatile announces that it has special [...]
C Puzzle #3
What is the output of the following programm? . . . . . . . . . . . . . . . . . . . Short answer -7 Long answer Signed integers are two’s complement binary values that can be used to represent both positive and negative integer values. Source: Intels IA-32 Architectures [...]
Check File Systems maximum path depth
Today, I’ve wondered how deep a path could be at maximum. I’ve guessed the file system may be limiting that, but perhaps also some tools that I use for basic operations like listing a folders contents would fail before. So I’ve created the following C-Snippet to test it: Now run it: Ok, something went wrong [...]
Part II: The Strassen algorithm in Python, Java and C++
This is Part II of my matrix multiplication series. Part I was about simple implementations and libraries: Performance of Matrix multiplication in Python, Java and C++ The usual matrix multiplication of two matrices has a time-complexity of . This means, if doubles, the time for the computation increases by a factor of 8. But you [...]

