AVL tree/C: Difference between revisions
m
Fixed syntax highlighting.
m (Fixed syntax highlighting.) |
|||
Line 1:
===Code===
<
#include <stdlib.h>
#include <time.h>
Line 182:
return 0;
}</
{{out}}
<pre>
Line 238:
<tt>AvlTree.h</tt>
<
#define AVLTREE_INCLUDED
Line 260:
void *Node_GetData (Node n);
#endif</
<tt>AvlTree.c</tt>
<
#include <stdlib.h>
#include "AvlTree.h"
Line 860:
return n;
}</
And here's the example which shows how to use the package. It creates in an endless loop random numbers between 0..999 and stores the number (the key) together with its square root (the value) in the tree. If an element with the given key is already in tree, it will be deleted.
<
#include <stdlib.h>
#include <unistd.h>
Line 924:
return 0;
}</
After a number of iterations, the tree will look similar to this:
|