Leaves - Alice#22
Open
sun-alice wants to merge 1 commit into
Open
Conversation
CheezItMan
reviewed
Sep 18, 2019
CheezItMan
left a comment
There was a problem hiding this comment.
Nice work! You hit all the learning goals here. See my note on delete_at and it's impact on runtime.
Otherwise excellent job!
|
|
||
| # Time Complexity: ? | ||
| # Space Complexity: ? | ||
| # Time Complexity: O(n), linear, because the amount of times the while loop iterates is directly proportionate to the length of the array. |
There was a problem hiding this comment.
Since you are using delete_at which has a runtime of O(n), you actually have O(n2) runtime complexity.
Remember delete_at shifts each of the subsequent elements over one index.
| # Space Complexity: ? | ||
| # Time Complexity: O(n*m), quadratic, because there are two loops present: the while and the each. Each of those loops are based on different data sizes, and are proportionate to the size of the data. | ||
| # Space Complexity: O(n), linear, because longest_prefix is a variable that may increase if the data size increases. | ||
| def longest_prefix(strings) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.