-
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
Laneia #39
base: master
Are you sure you want to change the base?
Laneia #39
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.
Hey Laneia,
Nice work, thanks for the PR. In the future with later submissions, can you ping me so I notice. Overall very well done. Take a look at my comments and let me know if you have questions.
# insert the new node at the beginning of the linked list | ||
# 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.
👍
# returns true if found, false otherwise | ||
# Time Complexity: O(n) | ||
# 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) | ||
# 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.
👍
# method to return the min value in the linked list | ||
# returns the data value and not the node | ||
# Time Complexity: O(n) | ||
# 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.
I think you meant space complexity O(1)
# returns the data value and not the node | ||
# Time Complexity: O(n) | ||
# Space Complexity: O(n) | ||
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.
👍
# assume indexing starts at 0 while counting to n | ||
# Time Complexity: O(n) | ||
# Space Complexity: O(1) | ||
def find_nth_from_end(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.
👍 Great work!
# returns true if a cycle is found, false otherwise. | ||
# Time Complexity: O(n) | ||
# Space Complexity: O(1) | ||
def has_cycle |
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!
# method that inserts a given value as a new last node in the linked list | ||
# Time Complexity: O(n) | ||
# Space Complexity: O(1) | ||
def add_last(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 linked list is empty | ||
# Time Complexity: O(n) | ||
# Space Complexity: O(1) | ||
def get_last |
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.
👍
# list is sorted in ascending order | ||
# Time Complexity: O(n) | ||
# Space Complexity: O(1) | ||
def insert_ascending(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.
👍
No description provided.