Skip to content
Related Articles

Related Articles

Improve Article

Importance of Randomized Algorithms

  • Last Updated : 30 Jun, 2021

Introduction:

  • Randomization is an important concept, and hence randomization algorithms are used in a variety of fields, such as number theory, computational geometry, graph theory, and distributed computing.
  • The inputs for a randomized algorithm are similar to those of deterministic algorithms, along with a sequence of random bits that can be used by the algorithm for making random choices.
  • In other words, a randomized algorithm is one whose behavior depends on the inputs, similar to a deterministic algorithm, and the random choices are made as part of its logic.
  • As a result, the algorithm gives different outputs even for the same input.
  • In other words, the algorithm exhibits randomness; hence its run-time is often explained in terms of a random variable.

Advantages:

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.  To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

In case you wish to attend live classes with experts, please refer DSA Live Classes for Working Professionals and Competitive Programming Live for Students.

  • Randomized algorithms are known for their simplicity.
  • Any deterministic algorithm can easily be converted to a randomized algorithm. These algorithms are very simple to understand and implement.
  • Randomized algorithms are very efficient.
  • They utilize little execution time and space compared to any deterministic algorithms.
  • Randomized algorithms exhibit superior asymptotic bounds compared to deterministic algorithms.
  • In other words, the algorithm complexity of randomized algorithms is better than that of most deterministic algorithms.
  • Reliability is an important issue in many critical applications, as not all randomized algorithms always give correct answers.
  • In addition, many randomized algorithms may not terminate.
  • Hence, reliability is an important concern that needs to be dealt with.
  • The quality of randomized algorithms is dependent on the quality of the random number generator used as part of the algorithm.
  • Unlike other design paradigms, a randomized algorithm does not use a single design principle.
  • Instead, one should view randomized algorithms as those designed using a set of principles.
  • Instead, one should view randomized algorithms as those designed using a set of principles.

Some design principles are listed in the following subsections:



Concept of Witness:

  • This principle involves the question of checking whether a given input possesses a property X or not.
  • It is established by finding a certain object called a witness or a certificate.
  • The witness is identified to prove the fact that the input indeed has the desired property X.
  • By conducting fewer trials, it can be found out whether the property was really present.
  • The presence of a witness is strong proof of property X based on the absence of witnesses. This principle is illustrated using the example of primality testing.

Fingerprinting:

  • By definition, a fingerprint is a shorter message that is representative of a larger object.
  • Fingerprinting is a technique wherein one makes a comparison of two large objects, A and B, only by comparing their respective short fingerprints.
  • If two fingerprints do not match, then objects A and B are different.
  • However, if the fingerprints match, then there is strong circumstantial evidence that both objects are the same.

Checking Identities:

  • Let us assume that an algebraic expression is given, and the problem is to check whether the expression evaluates to zero or not.
  • The principle of checking identities is to plug the random variables of a given algebraic equation and check whether the expression evaluates to zero.
  • If it is not zero, then the given expression is not an identity.
  • Otherwise, there is strong circumstantial evidence that the expression is identically zero.

Random Sampling and Ordering:

  • The performance of an algorithm sometimes improves by randomizing the input distribution or order.
  • It can be observed that for certain ordering of the input, the performance of the algorithm can be higher or just acceptable.
  • Here, randomization leads to randomized ordering, partitioning, and sampling.
  • In addition, randomized algorithms gather information about input distributions using random samples. This is illustrated through the hiring problem.

Foiling the Adversary:

  • A randomized algorithm can be viewed as a game between a person and an adversary, that is, a person proposing an algorithm and an adversary who tries to foil the algorithm by designing suitable inputs so that the algorithm takes a longer time.
  • In other words, a randomized algorithm can be viewed as a selection of an algorithm from a large set of deterministic algorithms, and this selection can be considered a scenario where things are made difficult by giving random input, thus making the task more difficult.
My Personal Notes arrow_drop_up
Recommended Articles
Page :