]>
git.ipfire.org Git - thirdparty/squid.git/blob - test-suite/splay.cc
2 * $Id: splay.cc,v 1.1 2003/02/05 10:37:14 robertc Exp $
4 * based on ftp://ftp.cs.cmu.edu/user/sleator/splaying/top-down-splay.c
5 * http://bobo.link.cs.cmu.edu/cgi-bin/splay/splay-cgi.pl
28 compareint(void const *a
, void const *n
)
30 intnode
*A
= (intnode
*)a
;
31 intnode
*B
= (intnode
*)n
;
32 //((splayNode *)n)->data;
37 printint(void *a
, void *state
)
39 intnode
*A
= (intnode
*)a
;
44 main(int argc
, char *argv
[])
48 splayNode
*top
= NULL
;
50 for (i
= 0; i
< 100; i
++) {
51 I
= (intnode
*)xcalloc(sizeof(intnode
), 1);
53 top
= splay_insert(I
, top
, compareint
);
55 splay_walk(top
, printint
, NULL
);