Questions tagged [randomized-algorithm]

Randomized algorithms are algorithms that in some way make use of randomness. The main types of randomized algorithms are Las Vegas and Monte Carlo algorithms.

Related terms:

  • Las Vegas algorithm
  • Monte Carlo Algorithm
  • Randomized polynomial time (RP)
  • Probabilistic polynomial time (PP)

More info:

Wikipedia on Randomized algorithms

41 questions
2
votes
2 answers

how to shuffle an array except for the item in the middle?

I´m creating a Bingo board and I need that the one in the middle always stays the same even when shuffleing this array: const bbb = [ "", "", "", "", "", "", "", "", "", "", " ", "", "", "", "", "", " ", "…
2
votes
1 answer

How can I make randomization automatic on REDCap?

I am running a survey on REDCap where participants need to be assigned to one of three groups before receiving a group-specific intervention to reduce their smartphone use (e.g., 1 - intervention one, 2 - intervention 2, 3 - intervention 3). I have…
2
votes
2 answers

Why is randomised quicksort considered better than standard quicksort?

In Cormen's own words - "The difference is that with the deterministic algorithm, a particular input can elicit that worst-case behavior. With the randomized algorithm, however, no input can always elicit the worst-case behavior." How does adding a…
Ayush
  • 91
  • 1
  • 10
2
votes
0 answers

Communication of client/server instead returning random numbers is returning random symbols

I need to print random numbers that servers sends, but instead its printing random symbols Its a program like lottery, that gives me 5 numbers and 2 stars I search for solution but I didn't find any. Someone can help? This is my code, the important…
Hugo Anes
  • 21
  • 2
2
votes
1 answer

bipartite network Degree-preserving randomization with constraints

I am working on a sample data containing several papers, the topics they belong to, and the publication years of those papers, it looks like…
2
votes
3 answers

Block randomization using python?

I have the following input table (df): ColumnA ColumnB Blocks A 12 1 B 32 1 C 44 1 D 76 2 E 99 2 F 123 2 G 65 2 H 87 3 I 76 3 J 231 3 k 80 4 l 55 4 m 27 5 n 67 5 o 34 5 I would like to perform block…
MuSu18
  • 159
  • 9
2
votes
3 answers

Data structure to achieve random delete and insert where elements are weighted in [a,b]

I would like to design a data structure and algorithm such that, given an array of elements, where each element has a weight according to [a,b], I can achieve constant time insertion and deletion. The deletion is performed randomly where the…
user5965026
  • 465
  • 5
  • 16
1
vote
1 answer

How to randomize or shuffle only one-axis and estimate estimated correlation in R?

I am trying to create a null expectation in R. The dataset has four species and associated sample values of x.real and y.real. I want to create a null expectation by only shuffling the x.real for each species. Estimate slope. Repeat 1000 times, say.…
Rspacer
  • 2,369
  • 1
  • 14
  • 40
1
vote
1 answer

If A is in RP and there is a polynomial time reduction from B to A then B in RP?

I think it's true because you can reduce B to A and then run the probabilistic algorithm of A and if we got a reject then it's also a reject for B and at least half of the time if the input is in A we would get an accept which means that at least…
1
vote
1 answer

How to insert a random element on a Anki card?

On Anki, the front of a card have "X+Y?" and the back shows "Z". For example, front "4+7?" and back "11" But I want next time that I see this card the numbers be different, randomizing the X, Y and Z elements. This could be possible picking the…
William PT
  • 11
  • 2
1
vote
2 answers

How to make monthly data to daily data using random techniques in R

I need to transform this monthly data to daily data by using some randomization technique, for example. Here is the dataframe: library(dplyr) library(lubridate) month_year <- c(…
1
vote
1 answer

Replace commas with spaces ? Fisher-Yates randomization

Thanks to @axtck for the help for the Fisher Yates randomization, he helped me to change number into words here : Since the shuffle functions shuffle the arrays indexes, you can just shuffle the array the same way you did but add name strings in the…
1
vote
1 answer

Randomly allot values to the rows in python

I have the following input table (y): parameter1 parameter2 1 12 2 23 3 66 4 98 5 90 6 14 7 7 8 56 9 1 I would like to randomly allot values from A1 to A9. The output table should look like the…
MuSu18
  • 159
  • 9
1
vote
0 answers

Printing an array as an ArrayType in Pascal

This program is supposed to sort an array and fill it with random integers from 1 to 1000. It needs to find the maximum value and print the array. It should print the array in two ways: ARRAY OF INTEGER and ArrayType. I need help to print this array…
1
vote
1 answer

Is exectution time of Skip list different after every run for same input?

I know this question is quiet trivial but I am curious to understand about what is actual impact on execution time of skip list algorithm that is randomized algorithm on time of execution. Are they different at every run? If they are is this one of…
1
2 3