-
Notifications
You must be signed in to change notification settings - Fork 47
KS #40
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?
KS #40
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.
Hey Kate, thanks for the PR.
Most of the methods you have work great. If you find time to finish the rest ping me and I'll take a look at them. Please review my comments and let me know if you have questions or if I'm not making sense. One thing I'd like is to see you indicate the time & space complexity of each method.
| # insert the new node at the beginning of the linked list | ||
| # Time Complexity: | ||
| # Space Complexity | ||
| 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 & Space Complexity?
| # returns true if found, false otherwise | ||
| # Time Complexity: | ||
| # Space Complexity | ||
| def search(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 & Space Complexity?
| # returns the data value and not the node | ||
| # Time Complexity: | ||
| # Space Complexity | ||
| def find_max |
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.
👍
| # returns the data value and not the node | ||
| # Time Complexity: | ||
| # Space Complexity | ||
| def find_min |
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.
👍
| current = @head | ||
|
|
||
| while current | ||
| i++ |
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.
++ doesn't really work as an operator in Ruby. It treats this as i plus some positive number.
| i++ | |
| i += 1 |
| # method to delete the first node found with specified value | ||
| # Time Complexity: | ||
| # Space Complexity | ||
| def delete(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.
👍
| # returns nil if the list is empty | ||
| # Time Complexity: | ||
| # Space Complexity | ||
| 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.
👍
No description provided.