Master programming syntax, solve interactive challenges & run live code in Syntaxis Explore Arena →
menu_book Course Curriculum (Data Structures & Algorithms) expand_more
Complexity & Foundations
Arrays & Strings
Linked Lists
Stacks & Queues
Hashing
Trees & Heaps
Graphs
Sorting Searching & DP
Data Structures & Algorithms / Complexity & Foundations

Linear time

Learn Linear time in Data Structures & Algorithms with a focused explanation, a topic-specific example, edge guidance, and a mastery check.

12 min read • Beginner
data-structures-algorithms-006.py
python
def count_positive(values):
    return sum(1 for x in values if x>0)  # O(n)
print(count_positive([-2,1,3,0,8]))
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content