Question

In: Computer Science

Ten world-class pharmaceutical companies and three African herbal medicine factories have developed algorithms for developing an...

Ten world-class pharmaceutical companies and three African herbal medicine factories have developed algorithms for developing an efficacious preventive and curative vaccine for coronavirus pandemic that is currently ravaging the world economy. The World Health Organization has engaged you as a Consultant to analyze those algorithms; and you intend to use Big-O notation for that task.
(i). Discuss, in detail, what you will do on this assignment (using the Big-O notation).
(ii). Make a cogent assessment of the relevance of using Big-O notation in analyzing the three pharmaceutical companies’ algorithms.

Solutions

Expert Solution

i)

Big O notation is used to define the output or complexity of an method. Big O explicitly defines the worst-case situation and could be used to define the time of execution needed or the space utilized (e.g. in memory or on disk) by an optimization. As a developer-first or a computer scientist second (or maybe third or fourth) users found the best way to fully understand Big O was to generate some regarding reasons. As a result, below are some prevalent orders of growth alongside characterizations and instances where possible.

  • O(1).
  • O(N).
  • O(N2).
  • O(2N).

(ii):-

The big-O notation is a measure used to find the complexity of the algorithm. Broadly speaking, the Big-O notation means the relationship between the parameters to the algorithm and the steps needed to accomplish the algorithm. It is represented by a big "O" accompanied by the raising and lowering of the parenthesis. Inside the parenthesis, the relationship between the input and the measures taken by the method is shown using "n."

For example, if there is a linear relationship between the input and the major step by the method to complete its operation, the Big-O notation used would be O(n). Likewise, the Big-O terminology for quadratic functions is O(n^2).

Basic Functions of Big-O notation:-

  • Constant -O(c).
  • Linear -O(n).
  • Quadratic -O(n^2).
  • Cubic -O(n^3).
  • Exponential -O(2^n).
  • Logarithmic -O(log(n)).
  • Log Linear -O(nlog(n)).

Explanation:

(i)

Big O notation is the terminology that the user used to speak about how long an algorithm takes to run. This is how users compare the efficiency of different methods to a problem. It's like math, except that it's a great, non-boring kind of algebra where users get to wave the hands over the specifics and just concentrate on what's going on. With big O notation, users express the runtime in aspects of — brace meditate — how fast it grows relative to the feedback, as the input receives arbitrarily large.

Let's explain a couple of things:-

  • How quickly the runtime grows:- It's difficult to assign the accurate runtime of an algorithm. It depends on how fast the processor is, what else the machine is doing, etc. So instead of thinking about runtime explicitly, users use the big O notation to think about how fast the runtime is increasing.
  • Relative to the input:-If users were to measure the runtime directly, the user could express our frequency in seconds. Since users measure how fast our runtime is growing, users need to convey the speed in terms of something else. With Big O notation, the user uses the size of the input that the user calls "n." So users can make statements like runtime grows "on the attempt of the input size" (O(n))or "on the attempt of the square of the input size" (O(n2)).
  • As the input gets arbitrarily large:-Our algorithm might well have phases that seem costly when n is low but are gradually overwhelmed by other steps when n is getting big. For the big O analysis, users care most about things that grow quickest as the input grows, because everything else will be quickly outpaced as n gets very large.

O(1) :-

It defines an algorithm that will still run at the same time (or space) irrespective of the input size sequence.

bool Is NullfirstElement(IList<string> elements)

{

  return elements[0] == null;

}

O(N):-

It defines an algorithm whose output will evolve linearly and directly about the magnitude of the input data set. The instance below also shows how Big O favors the worst-case performance situation; a matching string can be discovered throughout any installment of the for loop and the component would come back early, but Big O notation will still assume the upper limit where the method will execute the number of iterations.

bool ContainsValue(IList<string> elements, string value)

{

  foreach (var element in elements)

  {

    if (element == value) return true;

  }

  return false;

}

O(N2):-

It symbolizes an algorithm whose productivity is dependent on the input size. This is typical with methodologies that involve nested implementations over the data set.

bool ContainsDuplicates(IList<string> elements)

{

  for (var outer = 0; outer < elements.Count; outer++)

  {

    for (var inner = 0; inner < elements.Count; inner++)

    {

      // Don't compare with self

      if (outer == inner) continue;

      if (elements[outer] == elements[inner]) return true;

    }

  }

  return false;

}

O(2N):-

It is an optimization whose development doubles with each contrast to the input data. The growth pattern of the O(2N) function is accelerating-starting very shallow, then increasing meteorically. The recursive measurement of Fibonacci numbers is an instance of an O(2N) function:-

int Fibonacci(int number)

{

  if (number <= 1) return number;

  return Fibonacci(number - 2) + Fibonacci(number - 1);

}

(ii)

The Big O notation determines the upper limit of the algorithm, limits the function only from overhead. Consider, for instance, the scenario of Insertion Sort. In the best case, it requires linear time and in the worst case, requires quadratic time. Users could even comfortably assume that the processing time of the Insertion is O(n^2).

The specific step-wise operation for analysis of Big-O runtime:

  • Find out what the source is and what the n is.
  • Express the full set of activities that the algorithm conducts in terms of n.
  • Eliminate all criteria except those of the highest order.
  • Delete all the constants.

Properties for Big-O notation analysis:-

  • Constant Multiplication.
  • Polynomial Function.
  • Summation Function.
  • Logarithmic Function.

In practical systems, users primarily used to measure the exact worst-case conceptual running time complications of the performance analysis equations. The quickest running time for any method is O(1), typically called to as Constant Running Time. In this scenario, the method always takes a considerable level of time to implement, irrespective of the key length. This is the optimal runtime for a method, but it's rarely possible.

please give me a like


Related Solutions

How have developed Western countries affected non-western developing nations during the modern period? Explain how three...
How have developed Western countries affected non-western developing nations during the modern period? Explain how three political, economic, and/or cultural approaches by European and other Western countries shaped the developing world over the last 250 years.
assum have a Class enum Suit{ CLUBS , DIAMONDS,SPADES,HEARTS; } Class enum Raml { TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE,TEN, JACK,QUEEN,KING,...
assum have a Class enum Suit{ CLUBS , DIAMONDS,SPADES,HEARTS; } Class enum Raml { TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE,TEN, JACK,QUEEN,KING, ACE; } public class Card {       private Suit suit;    private Rank rank;    public Card (Rank rank, Suit suit){           this.suit = suit;        this.rank = rank;    }    public Suit getSuit() {        // TODO Auto-generated method stub        return suit;    }    public Rank getRank() {        return rank;    }...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT