-
Notifications
You must be signed in to change notification settings - Fork 47
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
Sockets - Grace #38
base: master
Are you sure you want to change the base?
Sockets - Grace #38
Conversation
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.
Thanks for the PR. Sorry I didn't notice it till now. The methods you have here look really good. Nice work!
# insert the new node at the beginning of the linked list | ||
# Time Complexity: O(1), no need to traverse | ||
# 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.
👍
# returns true if found, false otherwise | ||
# Time Complexity: O(n), we may need to traverse all nodes | ||
# Space Complexity: O(1) | ||
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.
👍
# returns the data value and not the node | ||
# Time Complexity: O(n), we may need to traverse all nodes | ||
# Space Complexity O(1) | ||
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: O(n), we may need to traverse all nodes | ||
# Space Complexity: O(1) | ||
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.
👍
# method that returns the length of the singly linked list | ||
# Time Complexity: O(n), we may need to traverse all nodes | ||
# Space Complexity: O(1) | ||
def length |
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 there are fewer nodes in the linked list than the index value | ||
# Time Complexity: O(n), we may need to traverse all nodes | ||
# Space Complexity: O(1) | ||
def get_at_index(index) |
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.
👍
# method to print all the values in the linked list | ||
# Time Complexity: O(n), we may need to traverse all nodes | ||
# Space Complexity: O(1) | ||
def visit |
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.
👍
# method to delete the first node found with specified value | ||
# Time Complexity: O(n), we may need to traverse all nodes | ||
# Space Complexity O(1) | ||
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.
👍
# note: the nodes should be moved and not just the values in the nodes | ||
# Time Complexity: O(n), we may need to traverse all nodes | ||
# Space Complexity: O(1) | ||
def reverse |
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!
No description provided.