The following diff (compared to 6dd2f42eb9) change the worst case runtime complexity to strictly linear (no coefficient different than one for the linearity) in the number of comments with at least one answer.
diff --git a/search_in_youtube_video_comments.py b/search_in_youtube_video_comments.py
index b4c3c29..52514d3 100755
--- a/search_in_youtube_video_comments.py
+++ b/search_in_youtube_video_comments.py
@@ -33,7 +33,7 @@ while True:
snippet = item['snippet']
treatComment(snippet['topLevelComment'])
totalReplyCount = snippet['totalReplyCount']
- if totalReplyCount > 5:
+ if totalReplyCount > 0:
parentId = item['id']
commentsNextPageToken = ''
while True:
@@ -43,10 +43,6 @@ while True:
if not 'nextPageToken' in commentsData:
break
commentsNextPageToken = commentsData['nextPageToken']
- else:
- if totalReplyCount > 0:
- for comment in item['replies']['comments']:
- treatComment(comment)
if not 'nextPageToken' in data:
break
nextPageToken = data['nextPageToken']
but then the complexity at runtime would become in the worst case strictly linear in the number of comments.
The following diff (compared to 6dd2f42eb9b19e17cf14638e45560c4b55d96337) change the worst case runtime complexity to strictly linear (no coefficient different than one for the linearity) in the number of comments with at least one answer.
```diff
diff --git a/search_in_youtube_video_comments.py b/search_in_youtube_video_comments.py
index b4c3c29..52514d3 100755
--- a/search_in_youtube_video_comments.py
+++ b/search_in_youtube_video_comments.py
@@ -33,7 +33,7 @@ while True:
snippet = item['snippet']
treatComment(snippet['topLevelComment'])
totalReplyCount = snippet['totalReplyCount']
- if totalReplyCount > 5:
+ if totalReplyCount > 0:
parentId = item['id']
commentsNextPageToken = ''
while True:
@@ -43,10 +43,6 @@ while True:
if not 'nextPageToken' in commentsData:
break
commentsNextPageToken = commentsData['nextPageToken']
- else:
- if totalReplyCount > 0:
- for comment in item['replies']['comments']:
- treatComment(comment)
if not 'nextPageToken' in data:
break
nextPageToken = data['nextPageToken']
```
Could also remove:
```py
totalReplyCount = snippet['totalReplyCount']
if totalReplyCount > 0:
```
but then the complexity at runtime would become in the worst case strictly linear in the number of comments.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The following diff (compared to
6dd2f42eb9) change the worst case runtime complexity to strictly linear (no coefficient different than one for the linearity) in the number of comments with at least one answer.Could also remove:
but then the complexity at runtime would become in the worst case strictly linear in the number of comments.