-
Notifications
You must be signed in to change notification settings - Fork 48
Branches - Emily Ball #26
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
base: master
Are you sure you want to change the base?
Conversation
CheezItMan
left a comment
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.
As you noted it's not reversing in place. It's also using the = sign to change my_sentence and it has problems with the tests. You do have a good sort. Take a look at my comments and let me know if you have questions.
| # Time complexity: O(n^2) | ||
| # Space complexity: O(n) | ||
|
|
||
| # Doesn't reverse in place - still working |
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.
Gotcha
| hi -= 1 | ||
| low += 1 | ||
| end | ||
| my_sentence = words.join |
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.
Note my lesson in how functions work This won't change the argument. So the tests are failing.
| # Time complexity: O(n^2) | ||
| # Space complexity: O(1) | ||
|
|
||
| def sort_by_length(my_sentence) |
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 insertion sort.
| # Time complexity: ? | ||
| # Space complexity: ? | ||
| # Time complexity: O(n^2) | ||
| # Space complexity: O(1) |
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.
Technically this has space complexity of O(n) since you do .split
| @@ -0,0 +1,19 @@ | |||
| # require_relative "test_helper" | |||
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.
Why are these commented out? Made me wonder what was up.
Sorting & Reverse Sentence