Dec-22-2021, 07:13 PM
Hi,
I come from c++ to python world recently, and am looking for c++ set (basically a balance/red-black tree structure, i think) equivalent container, but I can't find any. I did a quick google, and the closest I could get is bisect + List, which can have O(logN) search time, but can't achieve the O(logN) for insert/delete.
My question: is there such a standard container/Data struct? If not, how people typically get around?
One strong feeling I have, since I come from c++, is that python can do quite a lot of things easily (easier than c++), but most probably not as efficiently. Trying to find a c++ set equivalent in Python is one example to address this feeling.
Thank you!
--Karl
I come from c++ to python world recently, and am looking for c++ set (basically a balance/red-black tree structure, i think) equivalent container, but I can't find any. I did a quick google, and the closest I could get is bisect + List, which can have O(logN) search time, but can't achieve the O(logN) for insert/delete.
My question: is there such a standard container/Data struct? If not, how people typically get around?
One strong feeling I have, since I come from c++, is that python can do quite a lot of things easily (easier than c++), but most probably not as efficiently. Trying to find a c++ set equivalent in Python is one example to address this feeling.
Thank you!
--Karl