Unexpected stuff!

Let’s have a look at this code: int main() { for(int i{0};i<500;i++) { std::cout<<“This is a big number: “<<i*20000000<<std::endl; } } And let’s compile it with g++ using the flag -O3, what’s going to happen? Before answering, let’s have a look at the assembly, shall we? L16: movsbl 39(%ebx), %eax L6: movl %esi, %ecx movl… Continue reading Unexpected stuff!

Almost useless knowledge

Is almost useless because nobody is going to raise yours salary for that! Or maybe someone will?!? Let’s say we ignore all the benefits of all the optimizations our benevolent compiler is going to made on our code, and have a look at what happen when we execute some hundreds of thousands of times two very… Continue reading Almost useless knowledge

Subsequences and Fenwick tree’s

Let’s say that we have a sequence A of 1<=n<=10^5 elements, and that this sequence may or may not be ordered but all the numbers {1…n} are present exactly once. And now given 1<=k<=10, you’re asked to find all the increasing sub-sequences of A with exactly k+1 elements. This is a problem I get from a competitive programming… Continue reading Subsequences and Fenwick tree’s

Labyrinths (not really)

The labyrinthitis is a serious problem* which effect many people, is particularly common in people between the age of 18 to 99 owning a driving license and a car, you may encounter on the road on a daily basis people with this illness! Drive safe out there! If you are confused, well I understand!I’m trying to… Continue reading Labyrinths (not really)

The Pragmatic Programmer!

Is your first day at your new Corporation, you’re introduced to the company set of CORPORATE VALUES after a brief epistemological digression on the history of the world after the company was founded. A pretty HR girl talks excited of how the company you’re joining is the best place to work on the whole planet and… Continue reading The Pragmatic Programmer!