Skip to content

Laneia#39

Open
laneia wants to merge 1 commit intoAda-C11:masterfrom
laneia:master
Open

Laneia#39
laneia wants to merge 1 commit intoAda-C11:masterfrom
laneia:master

Conversation

@laneia
Copy link
Copy Markdown

@laneia laneia commented Oct 8, 2019

No description provided.

Copy link
Copy Markdown

@CheezItMan CheezItMan left a 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.

Comment thread lib/linked_list.rb
# insert the new node at the beginning of the linked list
# Time Complexity: O(1)
# Space Complexity: O(1)
def add_first(value)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread lib/linked_list.rb
# returns true if found, false otherwise
# Time Complexity: O(n)
# Space Complexity: O(1)
def search(value)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread lib/linked_list.rb
# returns the data value and not the node
# Time Complexity: O(n)
# Space Complexity: O(1)
def find_max
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread lib/linked_list.rb
# 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)
Copy link
Copy Markdown

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)

Comment thread lib/linked_list.rb
# returns the data value and not the node
# Time Complexity: O(n)
# Space Complexity: O(n)
def find_min
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread lib/linked_list.rb
# assume indexing starts at 0 while counting to n
# Time Complexity: O(n)
# Space Complexity: O(1)
def find_nth_from_end(n)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Great work!

Comment thread lib/linked_list.rb
# returns true if a cycle is found, false otherwise.
# Time Complexity: O(n)
# Space Complexity: O(1)
def has_cycle
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Nice!

Comment thread lib/linked_list.rb
# 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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread lib/linked_list.rb
# returns nil if the linked list is empty
# Time Complexity: O(n)
# Space Complexity: O(1)
def get_last
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread lib/linked_list.rb
# list is sorted in ascending order
# Time Complexity: O(n)
# Space Complexity: O(1)
def insert_ascending(value)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants