-
Notifications
You must be signed in to change notification settings - Fork 44
Earth - Anya #35
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?
Earth - Anya #35
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.
Nice work Anya, you hit all the learning goals here. Nice use of recursion. I will note that the looping solutions are better in terms of space complexity, but doing it recursively was good practice.
Well done.
| # Time Complexity: O(1) | ||
| # Space Complexity: O(1) | ||
| def add_first(value) |
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.
👍
| # Time Complexity: O(n) with n being the length of the linked list. | ||
| # Space Complexity: O(n) recursive pushes frames onto call stack for length of list. | ||
| def search(value, current = @head) |
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.
👍
| # Time Complexity: O(n) with n being the length of the linked list. | ||
| # Space Complexity: O(n) | ||
| def find_max(max_value = -1.0/0, current = @head) |
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.
👍 , interesting way to get - infinity
| # Time Complexity: O(n) with n being the length of the linked list. | ||
| # Space Complexity: O(n) | ||
| def find_min(min_value = 1.0/0, current = @head) |
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.
👍
| # Time Complexity: O(1) | ||
| # Space Complexity: O(1) | ||
| def get_first |
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.
👍
| # Time Complexity: O(n) | ||
| # Space Complexity: O(n) | ||
| def get_at_index(index, current = @head) |
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.
👍
| # Time Complexity: O(n) | ||
| # Space Complexity: O(n) | ||
| def visit(current = @head) |
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.
👍
| # Time Complexity: O(n) due to search, delete is O(1) | ||
| # Space Complexity: O(n) | ||
| def delete(value, previous = @head, current = @head) |
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.
👍
| # Time Complexity: O(n) | ||
| # Space Complexity: O(n) | ||
| def reverse(current = @head) |
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.
👍
| # Time Complexity: O(n) | ||
| # Space Complexity: O(n) | ||
| def get_last(current = @head) |
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.
👍
No description provided.