19h - Discrete Mathematics Growth of Functions 19-2...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction Growth of Functions Discrete Mathematics Andrei Bulatov Discrete Mathematics – Growth of Functions 19-2 Complexity of Algorithms How to measure what the efficiency of an algorithm is? Sorting algorithms: given a sequence of numbers, arrange it in the increasing order. Longer sequences require more time. The (time) complexity of a sorting algorithm is a function f such that processing a sequence of length n requires f(n) seconds. Not good: - computers are different, so, f(n) is ill-defined - different sequences of the same length may require different time The (worst case) (time) complexity of a sorting algorithm is a function f such that processing a sequence of length n requires at most f(n) steps. Discrete Mathematics – Growth of Functions 19-3 Comparing Algorithms There are more than 20 different sorting algorithms. Which one is the best? Consider two of them: bubble sort and merge sort. We use the same computer, so we can measure in seconds, rather than in steps. n
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

19h - Discrete Mathematics Growth of Functions 19-2...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online