Title

python | split函数时间复杂度

Posted on 2022-08-15 10:54  CuiQi  阅读(302)  评论(0编辑  收藏  举报

源码

    while (maxcount-- > 0) {
    while (i < str_len && STRINGLIB_ISSPACE(str[i]))
        i++;
    if (i == str_len) break;
    j = i; i++;
    while (i < str_len && !STRINGLIB_ISSPACE(str[i]))
        i++;
是O(n)

感谢:https://stackoverflow.com/questions/55113713/time-space-complexity-of-in-built-python-functions