Skip to content

Commit 903ca28

Browse files
committed
corrected big O for sorted in python
1 parent 4b08e4c commit 903ca28

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Sprint-2/improve_with_precomputing/common_prefix/common_prefix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def find_longest_common_prefix(strings: List[str]):
1515
longest = common
1616
return longest
1717
# before changes, it was N^2, bacause it got a for loop inside a for loop
18-
# after changes, it is N + N. The first N for sorted, and another N for the loop.
18+
# after changes, it is NlogN + N. The NlogN is the worst case for sorted, and another N for the loop.
1919

2020
def find_common_prefix(left: str, right: str) -> str:
2121
min_length = min(len(left), len(right))

0 commit comments

Comments
 (0)