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 trialLouis Sankey
22,595 PointsIs '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.
2 Answers
Donald Morales
15,983 PointsHello Louis,
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!
Jason Williamson
6,426 Pointswhat does "element" mean in this definition?
Zachary Claire
11,259 Points"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.
Louis Sankey
22,595 PointsLouis Sankey
22,595 PointsThanks, I think that's clear!