This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
0
Help analyzing how many times each step is executed.
Post Body
So I'm trying to figure out how many times each step in this algorithm is executed as a function of n.
for i =1 to n do
for j = 1 to n do
D[i,j] = 0
for k = 1 to n do
D[i,j] = D[i,j] D[i,k]
end for
end for
end for
Now I was able to come up with following answer:
for i =1 to n do #n 1
for j = 1 to n do #n(n 1)
D[i,j] = 0 #n^2
for k = 1 to n do #(n^2 n)*(n 1)
D[i,j] = D[i,j] D[i,k] #n^3
end for #n^3
end for #n^2
end for #n
Does this seem right? I feel as if I am missing something.
Note I am not trying to get a general formula, but am trying to find out how many times EACH line is executed relative to n
Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
No
Total Karma
13,404
Link Karma
4,110
Comment Karma
8,485
Profile updated: 3 days ago
Posts updated: 7 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 9 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/algorithms/...