











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
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
During the study of discrete mathematics, I found this course very informative and applicable.The main points in these lecture slides are:Analysis of Algorithms, Precise Instructions, Properties of Algorithm, Input Values, Output Values, Time Complexity, Space Complexity, Asymptotic Time Complexity, Pseudocode, Informal Statement, Algorithm Complexity
Typology: Slides
1 / 19
This page cannot be seen from the preview
Don't miss anything!
2
4
5
7
8
10
1 loop comparison
2 loop comparisons, 1 iteration of the loop
3 loop comparisons, 2 iterations of the loop
n loop comparisons, n-1 iterations of the loop
11
13
14
16
17
procedure bubblesort( a 1 , a 2 , …, an : distinct integers) for i = 1 to n- for j = 1 to n-i if ( aj > aj+1 ) then swap aj and aj+
Worst-Case : The sequence is sorted in decreasing order
At step i •The loop condition of the inner loop is executed n – i + 1 times. •The body of the loop is executed n – i times
19
procedure insertSort( a 1 , a 2 , …, an : distinct integers) for j=2 to n begin i=j - 1 while i > 0 and ai > ai+ swap ai and ai+ i=i- end
Worst-Case: The sequence is in decreasing order At step j, the while loop condition is executed j times the body of the loop is executed j-1 times