SystemTutor
About
Sign in
Loading course documentation…
SystemTutor

COURSES

  • Data Structures & Algorithms
  • CSS MasterclassNew course
  • System DesignNew course

PRACTICE

  • Algorithm practice
  • CSS practice

LEGAL

  • Privacy Policy
  • Terms of Service
  • About

© 2026 SystemTutor. All rights reserved.

Built with 🫶 by Shatlyk

Course Overview
Algorithm PerformanceBig O & Time ComplexitySpace ComplexityLogarithms and ComplexityProblem Solving ApproachAlgorithm Efficiency and Problem Solving
Big O Notation

Algorithm Performance

Compare correct algorithms by the work they perform and the memory they use as the input grows.

An algorithm is a sequence of steps that solves a problem. Suppose you need the smallest reading in a nonempty list of sensor measurements. Before comparing solutions, agree on what they must return.

Compare two correct solutions

For [5, 2, 8, 1, 9], both of these methods return 1:

  • Sort a copy. Make a new list, sort it from smallest to largest, and read the first value.
  • Scan once. Remember the first value, then compare each remaining reading with the smallest seen so far. The remembered value goes from 5 to 2, stays at 2 after seeing 8, drops to 1, then stays there after 9.

Two algorithms find the same minimum value, 1, using different amounts of work, time, and memory.

For five readings, the scan needs four comparisons and one variable for the current minimum. For a million readings, it needs 999,999 comparisons and the same variable. Sorting the copy also puts every other value in order, and it reserves memory for another list. If the only question is “which is smallest?”, the scan already does all the work you need.

Key Takeaways

  • Time complexity describes how the amount of work grows with the input size. Count the comparisons a scan makes before trying to predict elapsed seconds.
  • Space complexity describes how memory use grows. A remembered minimum stays small even as a copied list grows.
  • Start with the output the problem requires. A sorted list is useful when later operations also need the full ordering.

How is this lesson?

Previous lessonCourse OverviewNext lessonBig O & Time Complexity
Edit on GitHubReport on GitHub
On this page
%

On this page

Compare two correct solutionsKey Takeaways