I just moved the blog to new address: http://marcinjuraszek.com
You should be redirected to new page in few seconds. If you don't want to wait just click link above.
Question is, it the algorithm good and efficient? It returns correct results, that's for sure. But that's not the only important part of every algorithm. Unfortunately, I must say that the algorithm is no good. To answer why it's no a good algorithm? I'd like to show you another approach on solving the same problem:
Is has exactly the same signature and returns exactly the same results. Why is it better then? There are couple possible answers:
You may wonder why I tried the same algorithm on three different collections. That's because of how Skip/Take solution works: it iterates from that beginning of collection every time new partition is requested. It may not be important if your source is static collection (like Array or List), but it will cause Enumerable.Range to generate the collection every time again and again. That's really not necessary, is it?