March 3rd, 2012, 03:22 PM
[RESOLVED] Number of steps and Complexity
Hi, I'm new to this forum
I'm studying computer science at uni and can't quite figure out this question.
What is the number of steps required when the input list size is 5?
What is the number of steps required with input list size n?
what is the complexity class of the algorithm?
In the algorithm, the function distance(α,β) is given by the absolute difference
For list [L1,….,Ln].
1. Put m=27, i=1.
2. While i < n
For j = i+1 to n
If distance(Li,Lj) < m then m = distance(Li,Lj)
i = i+1
3. Return m.
between the position in the alphabet of α and β. For example, distance(b, f) = 4 and
distance(y, p) = 9.
If you could tell me how its worked out and what the answers are it would help me greatly.
Thanks in advance
Click Here to Expand Forum to Full Width