Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Computer Science

Jae Long
Jae Long
640 Points

Why check if size is 1?

If size is calculated using index which starts at 0 doesn't that mean if we had a linked list with two nodes size would equal one? But if those two nodes weren't in order we'd still return the linked list?

1 Answer

Hi Jae Long While I'm a newbie to the program, I might try a hand at your question. I think I understand the direction that you are coming from. Perhaps, the logic is that zero counts as a number, but zero is the absence of a number. Think of it this way. As 0 x 0 is 0.... and 1 x 1 is 1... and 0 + 1 is 1, then two nodes still = 2. Zero is void and would only be conceptual if there are no nodes. Does that make sense? It's great to challenge the data. It helps you learn and advance, so it's good that you ask. Others may have wondered too.