What is the time complexity of zip () in Python?

How to calculate the time complexity of zip ()?

    testList = [[1,2,3]for _ in range(5)]
    zip(*testList)
+4
source share
1 answer

Suppose you zip N iterables.

python 3.x zip O(1) , ( zip-) , ( , zip) - O(N), . next O(N). , - zip- O(N*M) , M ( ) , , ( zip).

python 2.x zip . , , O(N*M), , zipped iterables.

+8

All Articles