Generating Random String Using PHP
Generate a random, unique, alpha-numeric string using PHP. Examples:...
read more
Generating OTP (One time Password) in PHP
Now these days, OTP (one time password) is mandatory in almost each and every service. A developer can generate OTP in many ways but the challenge is not to be predictive as any one can predict the OTP and can exploit the service....
read more
Javascript Program For Selecting A Random Node From A Singly Linked List
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 random number generator.Below is a Simple Solution:...
read more
Image encryption using cellular automata
To propose an image encryption system using one dimensional cellular automata for image encryption and decryption. Cellular automata can be corresponded with the essential cryptographic properties i.e. Balance, correlation-immune, nonlinearity, easy to implement in hardware. CA cryptosystems can give better performances compared to classic methods that are based on computational techniques. Therefore, this technique should be most favourable for cryptography....
read more
Classification of Algorithms with Examples
There are many ways of classifying algorithms and a few of them are shown below:...
read more
XOR of a subarray (range of elements) | Set 2
Given an array integer arr[] of size N and Q queries. Each query is of the form (L, R), where L and R are indices of the array. The task is to find the XOR value of the subarray arr[L…R]....
read more
Disjoint Set Union (Randomized Algorithm)
A Disjoint set union is an algorithm that is used to manage a collection of disjoint sets. A disjoint set is a set in which the elements are not in any other set. Also, known as union-find or merge-find....
read more
Select a Random Node from a tree with equal probability
Given a Binary Tree with children Nodes, Return a random Node with an equal Probability of selecting any Node in tree.Consider the given tree with root as 1....
read more
Randomized Algorithms | Set 3 (1/2 Approximate Median)
We strongly recommend to refer below articles as a prerequisite of this....
read more
Importance of Testing In Competitive Programming
Many times while solving problems, we face issues like time limit exceeds, wrong solution, runtime error, and memory limit exceeds because after designing algorithm we don’t test algorithm efficiency, correctness, time complexity and running the algorithm on a large set of inputs for testing purpose...
read more
Find the player who wins the game by removing the last of given N cards
Given two integers N and K, where N represents the total number of cards present when game begins and K denotes the maximum number of cards that can be removed in a single turn. Two players A and B get turns to remove at most K cards, one by one starting from player A. The player to remove the last card is the winner. The task is to check if A can win the game or not. If found to be true, print ‘A’ as the answer. Otherwise, print ‘B’....
read more
C++ Program For Selecting A Random Node From A Singly Linked List
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 random number generator.Below is a Simple Solution:...
read more