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
Louis Sankey22,595 Points
Is 'n' typically the size of the data set, or the number to be searched for (or can it be either)?
I did a search but I'm still a little confused on this point.
In the context of determining complexity,
n refers to the size of the input in terms of how many elements it has.
I found the following quote on the Algorithmic Complexity web page by Victor S. Adamchik:
We define complexity as a numerical function T(n) - time versus the input size *n*
In the linear and binary search videos, the input set would be the range of numbers against which a check is being made.
I hope this helps.
Please let me know if it is still unclear!
"Element" simply refers to the items in the input. For example if the input is an array with 10 items, we can also say that it has 10 elements.