# Tag: algorithms

### Fast Discrete Approximation of Natural Neighbor Interpolation in 3D

Natural Neighbor is an interpolation scheme suitable for scattered data. It is based on weighted average approach and uses Voronoi diagram to determine relative contribution of given data points. Weights are defined as ratio of area “stolen” from known data points in the diagram by adding an interpolated data point […]

### Numerical string sorting in Clojure

Time for a bit of functional programming nostalgia. As Wikipedia mentions – http://en.wikipedia.org/wiki/Collation#Issues_with_numbers and hundreds of posts from interested people all over the Internet confirm – it is sometimes useful to have strings sorted using their numerical components. The simple algorithm below handles this task as it seems most reasonable […]

### Faster dot product for SVM

If you’ve ever used SVM for classification of 3D images, you’re probably a big fan of the kernel trick as it improves SVM performance significantly when working with such huge sets of features. I’m working in neuroscience at the moment and I think it’s fair to say that using SVM […]

### File-based merge sort

Time for the file-based merge sort code promised long ago. BSD licensed. Yes, I know it’s way too verbose, quite inefficient and probably pretty ugly but hey it’s just a general idea for you to improve and adjust to your specific needs. It’s intentionally this clear π It can sort […]

### I'm alive

I’m alive and well. In case you wondered what was stopping me from posting recently, the answer is PE #289, PE #294 and now the most recent PE #304. The last one was really easy (I had fallen asleep right before it was posted π and got to it the […]

### Project Euler #303

For a positive integer n, define f(n) as the least positive multiple of n that, written in base 10, uses only digits <=2. Thus f(2)=2, f(3)=12, f(7)=21, f(42)=210, f(89)=1121222. Also sum_n=1^100 {f(n)/n} = 11363107 Find sum_n=1^10000 {f(n)/n}. Phew… this was an easy one π I made it to the top […]

### Merge file sort and swap iterator

During my struggles with Project Euler Problem #302 I made an attempt to semi-brute force it. Unfortunately it required huge amounts of RAM (about 2e9 * 16 bytes) so I figured I could use some help from permanent storage. I implemented two helper classes, namely MergeSort and SwapIterator which look […]

### Project Euler #300

In a very simplified form, we can consider proteins as strings consisting of hydrophobic (H) and polar (P) elements, e.g. HHPPHHHPHHPH. For this problem, the orientation of a protein is important; e.g. HPP is considered distinct from PPH. Thus, there are 2n distinct proteins consisting of n elements. When one […]

### Paralell DP, BGL and other fun stuff ;)

I haven’t been posting for the past few days because I’ve been in WrocΕaw (Breslau) for the weekend and then I was kinda busy playing with new coding quests, this time from topcoder.com, my second big love after Project Euler (jeez, why nobody told me about these two before? π […]

### Becoming a Project Euler addict

Jeez, now I’ve solved Project Euler problems #297 and #299. I think I’m becoming an addict π #299 required quite a lot of help from my friend (thank you π ) while #297 was particularly easy. I managed to code it correctly in about 15 minutes π Can you? ;D […]