top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Can we find time complexity of an Algorithm if we have worst case and best case complexity?

+2 votes
277 views

Say we only know the worst case and best case complexity of an algo (Algo is not known). Is it possible to get the average case complexity?

posted Oct 5, 2015 by Aarati Mahajan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Answer will be NO, let me explain with example.

Suppose we have three number 5, 6, 7
So we are finding average = (5 + 6 + 7 ) / 3

So if we talk about a algorithm then the input will vary i.e input range and its value.

So to find average we need to consider all possible input values then only we can know the behavior of algorithm with input value.

So to find average case complexity we need to consider all possible inputs, not only best case and worst case as we can not guess the behavior of algo for other inputs.

answer Oct 9, 2015 by Sachidananda Sahu
Similar Questions
+3 votes

In an "N" element integer sorted array, a particular elements is repeating "(N/2)+1" times. How much time it take to find the repeating element.

+2 votes

Assume priority queue in Dijkstra’s algorithm is implemented using a sorted link list and graph G (V, E) is represented using adjacency matrix.

What is the time complexity of Dijkstra’s algorithm (Assume graph is connected)?

+2 votes
...