-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Branches - Erika #48
base: master
Are you sure you want to change the base?
Branches - Erika #48
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! See my notes on the time complexity, but your methods work. Well done!
index = 0 | ||
while index <= list.length | ||
if list[index] == list[index + 1] | ||
list.delete_at(index) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete_at
shifts each subsequent element left by one index. So that's an O(n) method. Since you have it nested in a loop running n times, remove_duplicates
becomes an O(n2) method.
if prefix[i] != comparison_word[i] | ||
i -= 1 | ||
prefix = prefix[0..i] | ||
if prefix == original |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could this if statement be true given the line above.
# Space Complexity: ? | ||
|
||
|
||
# Time Complexity: O(n * m) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct
No description provided.