📜  python 列表索引时间复杂度 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:44.726000             🧑  作者: Mango

代码示例1
lst = ["Alice","Bob","Duckie","Toucan"]
lst.index("Toucan")
3
The index function returns where the value given is in the string. 
The time complexity is O(n), as the worst case scenario requires iterating 
over n elements to find the desired result.