[英]What's a fast and pythonic/clean way of removing a sorted list from another sorted list in python?
[英]What is the best way to keep a sorted list in Python
我想在Python中保留一个排序列表。 我将按排序顺序在列表中插入元素。 我知道bisect模块。 但是,使用常规的python列表意味着在插入元素时将所有元素右移。 我想避免这种性能下降。 每次插入元素时,我都不想使用sorted()对列表进行排序。 是否有类似于Python中Guava(Java)TreeMultiset的数据结构?
看看rbtree应该符合您的要求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.