Skip to content
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

linked lists hw #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

linked lists hw #1

wants to merge 1 commit into from

Conversation

DStorck
Copy link
Member

@DStorck DStorck commented May 25, 2016

No description provided.

@sudocrystal
Copy link

So beautiful! Nice job!

size += 1
current = current.next_node
end
size += 1
end

Choose a reason for hiding this comment

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

This looks great and works, but in all of these (include?, size, and max) you had to account for that last node separately -- if you change your loop to while current != nil instead of while current.next_node != nil then you wouldn't need that! I told you to model after display which does it the latter way -- because sometimes you need to do something different with the last case and I wanted that to be the pattern I showed -- but now I want to point out how we could have optimized the pattern just slightly. Hopefully that makes sense!

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