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

Laura | Nodes #33

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

Conversation

lauracodecreations
Copy link

Time and Space complexity in comments of my code

i = 0
s = 0
e = 0

Choose a reason for hiding this comment

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

Minor: your indentation seems a little off.

@@ -1,4 +1,46 @@
# A method to reverse the words in a sentence, in place.
# A method to reverse the my_sentences in a sentence, in place.
# Time: O(n^2)

Choose a reason for hiding this comment

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

The time complexity of your algorithm is actually O(n). Take a read on an explanation on: https://github.com/Ada-C10/reverse_sentence/blob/solution/lib/reverse_sentence.rb

I'd also encourage you to elaborate your time and space complexity reasoning. Often, being able to explain your logic and reasoning is more important than getting the correct final answer.

@shrutivanw
Copy link

Looks good!

See comments inline about time and space complexity.

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