Randomized vs Deterministic Algorithms

 

Randomized vs Deterministic Algorithms

AspectDeterministic AlgorithmRandomized Algorithm
Basic ideaFollows a fixed sequence of steps to solve a problem.Uses random choices during the execution of the algorithm.
Decision makingDecisions are completely predictable.Some decisions are based on random numbers or random choices.
OutputProduces the same output for the same input.Output or the path taken may vary between different runs, depending on the type of randomized algorithm.
ExecutionFollows the same execution path for the same input.May follow different execution paths for the same input.
AccuracyUsually produces an exact and predictable result.May produce an exact result or an approximate result, depending on the algorithm.
Running timeUsually predictable for a given input.Running time may vary because of random choices.
ComplexityCan sometimes be more difficult to design for complex problems.Randomness can simplify the algorithm or help avoid unfavorable cases.
ExampleBinary search, merge sort, calculating the total price of items.Randomized Quicksort, random sampling, Monte Carlo simulation.
UseUsed when accuracy, consistency, and predictability are important.Used when efficiency, large search spaces, or uncertainty make deterministic methods less practical.
Simple exampleAdd the prices of all items in a shopping cart to get the exact total.Randomly select 200 customers from 10,000 customers to estimate overall satisfaction.

In Simple Words

Deterministic algorithm:

Same input → Same decisions → Same result

Randomized algorithm:

Same input → Random choices → Possibly different execution/result

Example:

If the college wants to estimate student satisfaction, randomly selecting a representative group of students and using their responses is a randomized approach.

If a college wants to include every student is a deterministic approach.

Comments

Popular posts from this blog

Algorithmic Thinking with Python UCEST 105- KTU First Semester BTech Course 2024 scheme notes pdf - Dr Binu V P 9847390760

Lab Experiments and Solutions - Algorithmic thinking with Python KTU S1 2024 scheme

PadLocking