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!

String searching algorithms comparison.

With nature OPHELIA sick had. heel him my MARCELLUS the A with my in comes not sweet if! A means may too; that quantity prepare did! have would not thou But do; thirty fortune, lament And are A of and havior There and. QUEEN am What worse kind. at might at wears that as That… Continue reading String searching algorithms comparison.

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

The real keyboard.

Back in the days, when computer were used by real computer users and nobody knew what a mouse is, the preferred input device was also the only input device: The Keyboard! When the hipster revolution began back in the seventies/eighties, the proliferation  of the mouse users increased dramatically, the keyboard was still the preferred computer input… Continue reading The real keyboard.

IO Stream performance.

Many of  the competitive programming portals available on the web advice –for certain problems involving huge input reading or output printing– the user to avoid cin/cout in spite of printf/scanf: As input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use scanf/printf instead of cin/cout in C++, prefer to use… Continue reading IO Stream performance.

Corporate people!

I’ve been in the IT industry since a while and since much longer I hang out with IT people. I now have a certain idea about what kind of people populate the cubicles of our lovely corporations! Understanding who is what is crucial in order to be sure that each and everybody is placed in the… Continue reading Corporate people!

Longest subsequence with K

Maybe some of you may wonder why lately I wasn’t posting any algorithm, or maybe not. But, I feel the compelling need to explain You the reason behind this behavior! Well, I’m working on my combinatorics book, which just happen to be a very demanding one, and it takes all my free time and free energies.… Continue reading Longest subsequence with K