Python的时间复杂度是多少? for in 带字符串的迭代构造?
for in
例如。,
for s in 'test: ... # s = t, e, s, t
循环的总运行时间是多少?
编辑:我看到我混淆了Python的字符串片段查找和索引查找。它的索引查找是O(1),因此总循环应该是O(n),与列表相同。