开发者

data structure for sets of strings

开发者 https://www.devze.com 2023-03-06 04:04 出处:网络
I was wondering if anyone could suggest a data structure for storing strings in two mutually exclusive sets. The operations would include adding and removin开发者_如何学Cg a string from a set, moving

I was wondering if anyone could suggest a data structure for storing strings in two mutually exclusive sets. The operations would include adding and removin开发者_如何学Cg a string from a set, moving a string from one set to the other, and returning the number of strings in each set. I'm considering a trie, but I'm not sure about returning the number of strings in each set.

I would like to implement it in C.


GLib has a hash table implementation you could use: http://developer.gnome.org/glib/2.28/glib-Hash-Tables.html


You could use two priority queues like Self-balancing binary search trees for each set. You could also use a treap.

0

精彩评论

暂无评论...
验证码 换一张
取 消