Moving to rrowniak.com

The blog is available at rrowniak.com. I decided to set up my own instance of WordPress to have a greater control over my kingdom and be able to make any customizations.

It should not be an issue as every post has been moved to my new website. In addition I’ll provide some translations to Polish so it’s going to be a bilingual blog.

Advertisements

std::vector vs sorted std::vector vs std::set

In this short article I’m going to make a comparison between std::vector, sorted std::vector and std::set. However, I’m going to focus only on one aspect – which collection is faster during lookup.

Looks like the answer is rather trivial – std::map and sorted std::vector offer access to any element in O(log n) time while unsorted std::vector offers linear finding. To be precise – std::vector + std::find as std::vector doesn’t have built-in find function. Indeed, sorted collections are winners… Or maybe the answer is not so trivial? Continue reading “std::vector vs sorted std::vector vs std::set”

New word order – sorting

Almost every modern language comes with sorting procedures. Is there any reason to dive into?

Very often it doesn’t matter which sorting procedure we select. Especially when we’re sorting a relatively small set of data, say, less than 1000 records, and the performance is not critical. Moreover, some languages give no options but one sorting procedure (taking into consideration only basic language facilities).

But what if we have gigabytes to be sorted? Let’s check out that case. Continue reading “New word order – sorting”

Ethereal stuff – volatile

In this article I’m going to share some details about the volatile keyword available in a number of programming languages like C++, C, Java. During my professional career, I have found out that the volatile type qualifier is frequently misunderstood and, what is even worse, incorrectly used (leading to nasty bugs).

I’ll show the differences between C/C++ and Java languages and present some examples. However, this is not a definitive guide. The main purpose of this article is to give some overview and highlight potential problems.

The volatile keyword differs from language to language, thus we can’t just write one definition for all. Fortunately, the volatile type identifier serves the same purpose in C and C++ (albeit C++ slightly extends the definition). Continue reading “Ethereal stuff – volatile”