Ad
  • Custom User Avatar

    Thank you for the explanations. I think that I am getting a bit closer to understand all of this.

  • Custom User Avatar

    Trying to understand the complexity here, am I right to think this is quadriatic due to fact that each slice operation time complexity is (omega) O(k). So as we doing two of them it is O(k) * 2 = O(k^2). Then there is iteration cost which is O(n). Not sure if this can be seen as k elements in the list as well therefore with slicing together ending in worst case scenario complexity of O(k^2) * k or O(k^3). Does this make any sense? :-)

    Souce of info: https://wiki.python.org/moin/TimeComplexity