-
Notifications
You must be signed in to change notification settings - Fork 48
Branches - Diana Han #41
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.
Not bad, you didn't get reverse_sentence in place, but otherwise this works well. Take a look at my comments and let me know if you have questions.
| return "" | ||
| end | ||
|
|
||
| array = my_sentence.split(/(\S*|\s*)/) # Split by each word and each space |
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.
This is making another array causing O(n) space complexity. You were asked to do the reverse in place.
| # Time complexity: O(n^2) | ||
| # Space complexity: O(n) | ||
|
|
||
| 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 bubblesort
| # Time complexity: O(n^2) | ||
| # Space complexity: O(n) |
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
Sorting & Reverse Sentence