Skip to content

Leaves - Georgina#26

Open
geomsb wants to merge 2 commits intoAda-C12:masterfrom
geomsb:master
Open

Leaves - Georgina#26
geomsb wants to merge 2 commits intoAda-C12:masterfrom
geomsb:master

Conversation

@geomsb
Copy link
Copy Markdown

@geomsb geomsb commented Feb 18, 2020

No description provided.

Georgina Sanchez and others added 2 commits February 17, 2020 21:31
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.

Nice work, you hit all the learning goals here. Well done. Take a look at my comments and let me know if you have questions. The methods you have written all work and you've demonstrated an understanding of how to implement a Linked List.

Comment thread lib/linked_list.rb
@@ -19,99 +19,327 @@ def initialize
# method to add a new node with the specific data value in the linked list
# insert the new node at the beginning of the linked list
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

# method to find if the linked list contains a node with specified value
# returns true if found, false otherwise
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

# method to return the max value in the linked list
# returns the data value and not the node
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
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


# method that returns the length of the singly linked list
def length
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

# find the nth node from the end and return its value
# assume indexing starts at 0 while counting to n
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.

👍

Comment thread lib/linked_list.rb
Comment on lines +253 to +254
i = @head
j = @head.next
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'd suggest using variable names other than i or j.

Comment thread lib/linked_list.rb
end

# method that inserts a given value as a new last node in the linked list
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

# method that returns the value of the last node in the linked list
# returns nil if the linked list is empty
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

# method to insert a new node with specific data value, assuming the linked
# list is sorted in ascending order
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