对于列表["foo", "bar", "baz"]和列表中的项目"bar",如何在Python中获取其索引(1)?
["foo", "bar", "baz"]
"bar"
python indexing list
给定二进制堆,我需要在O(log n loglog n)中创建一个包含堆中最小log n项的排序数组.
当然我尝试了删除最小日志n次的天真方法,但是需要O(log 2(n)).我不知道如何改进.
我很感激任何帮助,谢谢.
algorithm data-structures
algorithm ×1
data-structures ×1
indexing ×1
list ×1
python ×1