[Solved] Efficient way to add element to sorted datastructure [closed]


Most red black tree packages will have an “insert element” method. If you’re not using one already, it might be good to start.

If you’re married to a red-black tree implementation that doesn’t have an insert element operation, it’d be a good idea to add such a method, possibly from some good red-black tree doc:
http://en.wikipedia.org/wiki/Red%E2%80%93black_tree

BTW, a treap is often quite a bit faster than a red-black tree, but the red-black tree will likely have less variable performance:
http://stromberg.dnsalias.org/~strombrg/python-tree-and-heap-comparison/

solved Efficient way to add element to sorted datastructure [closed]