Load and Save an AVLTree from and to a file
Page 1 of 1
Load and Save an AVLTree from and to a file
Hello GAF-developers,
I am using a AVL Tree data structure to store text information.
The tree has the following structure:
typedef struct {
gAVLNode *top;
long count;
gAVLKey (*getkey)(const void *item);
gAVLCompare cmp;
} gAVLTree;
typedef struct _gAVLNode {
gAVLKey key;
long depth;
void *item; // word
struct Vector *v; // to each node is a list attached
struct _gAVLNode *parent;
struct _gAVLNode *left;
struct _gAVLNode *right;
} gAVLNode;
struct Vector {
int pos;
int capacity;
char **array;
};
1) I am reading words from a text file and inserting them into the tree. Some meta data is generated and stored into the Vector.
Now I would like to save the complete tree to a (binary) file and load it from there again.
2) In parallel to the Tree I am using a hashtable. I would like to save this to a file, too. And of course load it again into memory. Would be great if this could be part of the task as well.
The complete working C source code is provided together with a small introduction how to use it.
Its a pure shell command tool that was developed with gcc on a MacBook.
I am using a AVL Tree data structure to store text information.
The tree has the following structure:
typedef struct {
gAVLNode *top;
long count;
gAVLKey (*getkey)(const void *item);
gAVLCompare cmp;
} gAVLTree;
typedef struct _gAVLNode {
gAVLKey key;
long depth;
void *item; // word
struct Vector *v; // to each node is a list attached
struct _gAVLNode *parent;
struct _gAVLNode *left;
struct _gAVLNode *right;
} gAVLNode;
struct Vector {
int pos;
int capacity;
char **array;
};
1) I am reading words from a text file and inserting them into the tree. Some meta data is generated and stored into the Vector.
Now I would like to save the complete tree to a (binary) file and load it from there again.
2) In parallel to the Tree I am using a hashtable. I would like to save this to a file, too. And of course load it again into memory. Would be great if this could be part of the task as well.
The complete working C source code is provided together with a small introduction how to use it.
Its a pure shell command tool that was developed with gcc on a MacBook.
Similar topics
» Load flash movies directly from any source (no temporary files)+snap a frame
» Looking for a flash movie file
» Simple Exe file that opens a url download
» Plugin for IDEA IntelliJ to match braces in a text file
» Looking for a flash movie file
» Simple Exe file that opens a url download
» Plugin for IDEA IntelliJ to match braces in a text file
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum