坚持一个线索到一个文件 - ç [英] Persisting a trie to a file - C

查看:98
本文介绍了坚持一个线索到一个文件 - ç的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个特里里面我是用做一些字符串处理。我有一个简单的编译器从一些数据产生特里。一旦生成,我的特里将无法在运行时更改。

I have a trie which I am using to do some string processing. I have a simple compiler which generates trie from some data. Once generated, my trie won't change at run time.

我要寻找一种方法,我可以坚持在一个文件线索并有效地加载它。我看过 sqllite 来了解它们是如何坚持 B树,但它们的文件格式看起来有点先进的,我也可以并不需要所有这些。

I am looking for an approach where I can persist the trie in a file and load it effectively. I have looked at sqllite to understand how they are persisting b-treebut their file format looks bit advanced and I may not need all of those.

这将会是有益的,如果有人能提供一些思路坚持和阅读特里。我使用C语言进行编程。

It'd be helpful if someone can provide some ideas to persist and read the trie. I am programming using C.

推荐答案

我做了一些研究,发现下面的小宝石在线:

I did a some research and found the following little gems online:


  1. trie.h

  2. trie.c

与序列化和反序列化的一个工作线索。它原本是为在Python写的使用(有一个相应的 triemodule.c 它绑到Python),但它是纯C;你可以挖掘它的想法或者你想使用它。

A working trie with serialization and deserialization. It was originally written for use in Python (there's a corresponding triemodule.c for tying it to Python), but it's pure C; you could mine it for ideas or use it as you wish.

更新

它出现的链接不再工作。我会继续原稿最多,但这里是自由之路机链接:

It appears the links are no longer working. I'll keep the originals up, but here are the links in the wayback machine:


  1. trie.h

  2. trie.c

这篇关于坚持一个线索到一个文件 - ç的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆