Skip to content

Instantly share code, notes, and snippets.

Connor Lane Smith cls

  • Oxford Nanopore
  • Berkshire, UK
Block or report user

Report or block cls

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cls
cls / intern.c
Last active Aug 29, 2015
Interning strings with a prefix tree
View intern.c
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const char *
intern(const char *s)
{
union tree {
const char *str;
@cls
cls / CovariantIterator.java
Last active Aug 29, 2015
Adaptor for covariant iterators in Java
View CovariantIterator.java
import java.util.Iterator;
public class CovariantIterator<T extends U, U> implements Iterator<U>
{
private Iterator<T> iter;
public CovariantIterator(Iterator<T> it)
{
this.iter = it;
}
@cls
cls / roman.c
Last active Aug 29, 2015
Roman numeral parser
View roman.c
#include <stdio.h>
enum { I, V, X, L, C, D, M, StackSize };
const int values[] = { 1, 5, 10, 50, 100, 500, 1000 };
int
unroman(const char *s)
{
int stack[StackSize];
You can’t perform that action at this time.