Tutorials
Courses
Go Premium
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
32.1K+ articles
Misc
7.8K+ articles
Mathematical
5.1K+ articles
Arrays
4.2K+ articles
Strings
2.1K+ articles
Greedy
1.4K+ articles
Sorting
1.1K+ articles
Dynamic Programming
1.1K+ articles
Searching
1.0K+ articles
Tree
909+ articles
DSA
/
Algorithms
/
Randomized
Randomized
40 posts
Recent Articles
Popular Articles
Binomial Random Variables
Last Updated: 23 July 2025
In this post, we'll discuss Binomial Random Variables.Prerequisite : Random Variables A specific type of discrete random variable that counts how often a particular event ...
read more
Mathematical
Randomized
DSA
Find an index of maximum occurring element with equal probability
Last Updated: 16 March 2023
Given an array of integers, find the most occurring element of the array and return any one of its indexes randomly with equal probability.Examples:Input: arr[] = [-1, 4, ...
read more
Randomized
DSA
Implement rand12() using rand6() in one line
Last Updated: 08 July 2024
Given a function, rand6() that returns random numbers from 1 to 6 with equal probability, implement the one-liner function rand12() using rand6() which returns random numb...
read more
Randomized
DSA
Implement rand3() using rand2()
Last Updated: 09 June 2022
Given a function rand2() that returns 0 or 1 with equal probability, implement rand3() using rand2() that returns 0, 1 or 2 with equal probability. Minimize the number of ...
read more
Randomized
DSA
Generate 0 and 1 with 25% and 75% probability
Last Updated: 01 July 2022
Given a function rand50() that returns 0 or 1 with equal probability, write a function that returns 1 with 75% probability and 0 with 25% probability using rand50() only. ...
read more
Randomized
DSA
Randomized Algorithms | Set 0 (Mathematical Background)
Last Updated: 23 July 2025
Conditional Probability Conditional probability P(A | B) indicates the probability of even 'A' happening given that the even B happened.P(A|B) = \frac{P(A\cap B)}{P(B)}We ...
read more
Randomized
DSA
Randomized Algorithms | Set 3 (1/2 Approximate Median)
Last Updated: 23 July 2025
Time Complexity:We use a set provided by the STL in C++. In STL Set, insertion for each element takes O(log k). So for k insertions, time taken is O (k log k).Now replacin...
read more
Randomized
DSA
statistical-algorithms
median-finding
Fermat Method of Primality Test
Last Updated: 23 July 2025
Given a number n, check if it is prime or not. We have introduced and discussed the School method for primality testing in Set 1.Introduction to Primality Test and School ...
read more
Mathematical
Randomized
DSA
Modular Arithmetic
Prime Number
number-theory
Randomized Algorithms | Set 2 (Classification and Applications)
Last Updated: 23 July 2025
We strongly recommend to refer below post as a prerequisite of this. Randomized Algorithms | Set 1 (Introduction and Analysis)ClassificationRandomized algorithms are class...
read more
Randomized
DSA
Randomized Algorithms | Set 1 (Introduction and Analysis)
Last Updated: 23 July 2025
What is a Randomized Algorithm?An algorithm that uses random numbers to decide what to do next anywhere in its logic is called a Randomized Algorithm. For example, in Rand...
read more
Randomized
DSA
Analysis and applications Karger’s algorithm for Minimum Cut
Last Updated: 23 July 2025
We have introduced and discussed below Karger's algorithm in set 1.1) Initialize contracted graph CG as copy of original graph2) While there are more than 2 vertices. ...
read more
Graph
Randomized
DSA
Select a Random Node from a Singly Linked List
Last Updated: 23 July 2025
Given a singly linked list, select a random node from the linked list (the probability of picking a node should be 1/N if there are N nodes in the list). You are given a r...
read more
Linked List
Randomized
DSA
Introduction and implementation of Karger's algorithm for Minimum Cut
Last Updated: 23 July 2025
Given an undirected and unweighted graph, find the smallest cut (smallest number of edges that disconnects the graph into two components). The input graph may have paralle...
read more
Graph
Randomized
DSA
graph-connectivity
Load Balancing on Servers (Randomized Algorithm)
Last Updated: 23 July 2025
Consider a high traffic website that receives millions of requests (of different types) per five minutes, the site has k (for example n = 1000) servers to process the requ...
read more
Randomized
DSA
Expected Number of Trials until Success
Last Updated: 23 July 2025
Consider the following famous puzzle.In a country, all families want a boy. They keep having babies till a boy is born. What is the expected ratio of boys and girls in the...
read more
Mathematical
Randomized
DSA
harmonic progression
1
2
3
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !