You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
When solving a problem, there are often many possible algorithms. But how do you decide which one is best? Algorithm efficiency is the study of how much time and space (memory) an algorithm requires as the size of the input grows.
Consider searching for a name in a phone book with 1,000,000 entries:
Both solve the same problem, but binary search is vastly more efficient. For real-world applications processing millions of records, choosing the right algorithm can mean the difference between a result appearing in milliseconds or taking hours.
We measure the efficiency of an algorithm by counting the number of basic operations (comparisons, swaps, assignments, etc.) it performs relative to the input size, n.
We focus on how the number of operations grows as n increases, rather than the exact count.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.