Igor Ostrovsky on August 11th, 2008

Big-Oh notation is a simple and powerful way to express how running time of a particular algorithm depends on the size of the input. When you say that a particular algorithm runs in O(N2) time, you mean that the number of steps the algorithm takes is proportional to the input size squared. Or, in mathematical [...]

Continue reading about Big Oh in the parallel world

Igor Ostrovsky on July 21st, 2008

Skip lists are a fascinating data structure: very simple, and yet have the same asymptotic efficiency as much more complicated AVL trees and red-black trees. While many standard libraries for various programming languages provide a sorted set data structure, there are numerous problems that require more control over the internal data structure than a sorted [...]

Continue reading about Skip lists are fascinating!

Igor Ostrovsky on June 16th, 2008

There is a lot of information on the concurrent primitives and concepts exposed by the .NET Framework 3.5 available on MSDN, blogs, and other websites. The goal of this post is to distill the information into an easy-to-digest high-level summary: what are the different pieces, where they differ and how they relate. If you want [...]

Continue reading about Overview of concurrency in .NET Framework 3.5

I realized that there is a very clean way to express a multi-clause if statement by composing ternary conditional operators like this: var result = condition1 ? result1 : condition2 ? result2 : condition3 ? result4 … : conditionN ? resultN : default;

Continue reading about A neat way to express multi-clause if statements in C-based languages

Igor Ostrovsky on May 26th, 2008

In responses to my last week’s post, several readers mentioned LINQ-like operators they implemented themselves. I also had ideas for operators that would lead to neat solutions for some problems, so I decided to give it some thought and collect up the most useful operators into a reusable library. My goal was to include operators [...]

Continue reading about Extended LINQ: additional operators for LINQ to objects

Igor Ostrovsky on May 18th, 2008

Ever since I learned about LINQ, I keep discovering new ways to use it to improve my code. Every trick makes my code a little bit faster to write, and a little bit easier to read. This posting summarizes some of the tricks that I came across. I will show you how to use LINQ [...]

Continue reading about 7 tricks to simplify your programs with LINQ

Igor Ostrovsky on May 9th, 2008

The folks at Dev 102 posted a programming job interview challenge. It is rather easy, but I figured that it may be a nice change of pace, since my last posting was fairly involved. The challenge is to reverse the bits in each byte, given a large array of bytes. What is the fastest possible [...]

Continue reading about Programming job interview challenge

Igor Ostrovsky on May 4th, 2008

What is the time complexity of quicksort? The answer that first pops up in my head is O(N logN). That answer is only partly right: the worst case is in fact O(N2). However, since very few inputs take anywhere that long, a reasonable quicksort implementation will almost never encounter the quadratic case in real life. [...]

Continue reading about Quicksort killer

Igor Ostrovsky on September 6th, 2007

Today, I am writing about a design problem related to C# generics that I’ve seen arise a few times. The problem occurs when we need to manipulate a generic class given a reference to its non-generic base class. For example, if a generic class Node<T> inherits from a non-generic class Node, and we are holding [...]

Continue reading about Fun with C# generics: down-casting to a generic type

Igor Ostrovsky on July 20th, 2007

Says who? Google search engine, none other. Yesterday, I searched for my name, and my blog appeared as the fourth link. That surprised me, because I did not intend to make the blog public before I have some content here. As far as I know, nobody links here so far, so I didn’t expect Google to find me. [...]

Continue reading about It’s official: I exist