Download presentation
Presentation is loading. Please wait.
Published byAntonia Lloyd Modified over 9 years ago
1
Mathematical Preliminaries The Factorial Function Permutations Logarithms Summations Recurrence Relations Algorithm Analysis
2
The Factorial Function Definition: Stirling’s approximation:
3
Permutations A permutation of a sequence is the members of a sequence arranged in some order. There are n! different permutations for a sequence with n distinct members. To generate a permutation of an array: void permute(int *a, int n) { for (int i = n; i > 0; i--) swap(a[i - 1], a[random(i)]); }
4
Logarithms
5
Summations
6
Recurrence Relations For the factorial function: For the Fibonacci sequence:
7
Algorithm Analysis The time T to run an algorithm as a function of n is written as T(n) T(n) is in the set O(f(n)) if there are two positive constants c and n 0 such that If the upper bound (highest growth rate) for an algorithm is f(n) then it is in O(f(n)) in the worst case For all inputs that are large enough, the algorithm always executes in less time than
8
Comparison of Running Times in Increasing Order O(1) O(log n) O(n) O(n log n) O(n c ) O(c n )
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.