Analysis Of Algorithms University of Bridgeport Analysis of Algorithms
Download
3.4 Mb.
Page
2/33
Date
28.05.2018
Size
3.4 Mb.
#51061
1
2
3
4
5
6
7
8
9
...
33
if X[j] > X[j+1] -----line 3
temp := X[j] -----line 4
X[j] := X[j+1] -----line 5
X[j+1] := temp -----line 6
Statement #
#
of executions
1
n
2
(n-1)n
3
(n-1)(n-1)
4, 5, 6
T(n) = n + (n
2
– n) + (n
2
– 2n + 1) +
=
2n
2
– 2n + 1 +
Download
3.4 Mb.
Share with your friends:
1
2
3
4
5
6
7
8
9
...
33
The database is protected by copyright ©ininet.org 2024
send message
Main page
same amount