N-grams

srinivas devaki mr.eightnoteight at gmail.com
Thu Nov 10 02:50:11 EST 2016


On Thu, Nov 10, 2016 at 12:43 PM, srinivas devaki
<mr.eightnoteight at gmail.com> wrote:
> complexity wise it's O(N), but space complexity is O(N**2) to execute
> this function,

I'm sorry, that is a mistake.
I just skimmed through the itertoolsmodule.c, and it seems like the
space complexity is just O(N), as when tee objects are copied only the
current index is tracked, so the space complexity is just O(N) and
time complexity is also O(N) as tee object copy operation takes O(1)


Regards
Srinivas Devaki
Senior (4th year) student at Indian Institute of Technology (ISM), Dhanbad
Computer Science and Engineering Department
phone: +91 9491 383 249
telegram: @eightnoteight



More information about the Python-list mailing list