GliderJan Varho

Posts in category C:

Natural Order String Comparisons in C

  • algorithms
  • C
  • MIT license
  • sort
  • source
  • strcmp
  • strnatcmp

I wrote a simple natural string order comparison function in C. I later found out I basically reimplemented (a part of) Martin Pool's strnatcmp, so I renamed mine that as well.

The idea is that in many cases the string "foo10bar" should sort after "foo9bar" instead of in between "foo1bar" and "foo2bar" as happens with strcmp.

I also made "foo02bar" sort after "foo1bar", but made sure "foo0.02bar"

Hash Prioritized Treaps

  • algorithms
  • C
  • data structures
  • hash
  • random
  • treap

In looking for a data structure for a memory management problem I tried to find a self-balancing tree that would use as little space as possible. The only one I found from Wikipedia that didn't require any additional information at nodes was the scapegoat tree.

Unfortunately, it's not as easy to implement as the intro suggests. As a further complication, a scapegoat tree has some additional information

C for Blitzers

  • BlitzMax
  • C
  • tutorial

This tutorial attempts to show the basics of working with C in your BlitzMax programs. BlitzMax manual/help has a section titled "Interfacing with C and other languages", but I find it short and confusing. A PDF version (PDF, 142KB) of this tutorial is available, as are sources for samples (ZIP, 3KB).

1. Introduction