Various exercises related to big-o notation and searching in arrays and monotonically sorted matrices. Topics include the analysis of summations, big-o bounds, and searching algorithms.
Download Advanced Data Structures and Algorithm Analysis: Classwork Session 1 - Prof. R. Shah and more Study notes Computer Science in PDF only on Docsity!
CSC 3102
Adv Data Structures and
Algorithm Analysis
Classwork Session 1
Show the following bound:
1. ๏k=1 to n k = 1+2+3+...+n = ๏(nn^2 )
2. ๏ ๏k=1 to n k^2 = 1+4+9+...+n^2 = ๏(nn^3 )
Exercise on ๏ notation
Big-O exercise
(^) If d(nn) is O(nf(nn)) and e(nn) is O(ng(nn)
show that :
(^) d(nn) + e(nn) is O(nf(nn) + g(nn) )
(^) d(nn)e(nn) is O(nf(nn)g(nn))
(^) Is this true?
2 d(nn)^ is O(n2f(nn))
Searching
(^) Array A was supposed to be like
(^) A[i] = i
(^) However, due to an error one value
went missing so A[i] =i for i<k and
A[i] = i+1 for the rest.
(^) We have to find this missing value k
(^) Example : the missing value is 5 1 2 3 4 6 7 8 9 10 11 i = 1 2 3 4 5 6 7 8 9 10