/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ #include "Element.h" #include int compare(Element e1, Element e2) { int cmp = strcmp(e1, e2); return (cmp >= 0) - (0 >= cmp); } /* hash function as used in Java for Strings */ unsigned int hash(Element e) { unsigned int res = 0; while (*e != 0) { res = 31 * res + *e; ++e; } return res; }