Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Computer Science Introduction to Algorithms Playing a Counting Game Evaluating Binary Search

Louis Sankey
Louis Sankey
22,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.

Louis Sankey
Louis Sankey
22,595 Points

Thanks, I think that's clear!

1 Answer

Donald Morales
Donald Morales
Python Development Techdegree Student 15,982 Points

Hello 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!

what does "element" mean in this definition?