Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Branches - Erika #48

wants to merge 2 commits into from

Conversation

emaust
Copy link

@emaust emaust commented Sep 17, 2019

No description provided.

Copy link

@CheezItMan CheezItMan left a 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)

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

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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants