




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to asymptotic analysis in the context of CSE 332: Data Structures. It covers the importance of analyzing algorithm performance, the concept of correctness, and the use of proof by induction. The document also discusses how to measure performance, focusing on time complexity, and presents examples of linear and binary search algorithms. Lastly, it explains the concept of solving recurrence relations.
Typology: Study Guides, Projects, Research
1 / 8
This page cannot be seen from the preview
Don't miss anything!





2
3
4
5
6
sum(int array v, int n) returns int if n = 0 then sum = 0 else sum = nth number + sum of first n-1 numbers return sum
7
8
9
10
11
// Insert your algorithm here
What algorithm would you choose to implement this code snippet?^12
bool LinearArrayContains (int array[], int n, int key ) { for( int i = 0; i < n; i++ ) { if( array[i] == key ) // Found it! return true; } return false; }
Best Case:
Worst Case:
19
20
21
22
23
Remember: the “fastest” algorithm has the slowest growing function for its runtime
BS
24
25
26
B
27
28
29
30
37
38
39
40
41
lim ( )/ ( ) n h n f n 0
lim ( )/ n h n g n ( )
lim ( )/ ( ) n h n f n c 0 42
43
44
45
46
47