gohil90
BAN USER- 0of 0 votes
AnswersThere's a function named BiasedRandom which returns '0' with probability 'P' and returns '1' with probability '(1-P)'.
- gohil90 in India
So define a Random function which surely returns '0' and '1' both with probability 0.5 using the above mentioned function(BiasedRandom).
Note:
-The BiasedRandom function can be used any times in the Random function as you want.
-And on each call of BiasedFunction from the Random function returns '0' and '1' with same probability(say P and 1-P resp.) on single run.| Report Duplicate | Flag | PURGE
Directi Algorithm - 0of 0 votes
AnswersThere's an array of length N. For every element of array, say 'X' , find a element 'Y' in the same array such that,
- gohil90 in India
1. Value of Y<Value of X
2. Position of Y<Position of X
3. Position of Y should be as large as possible.
Note: If there's no such element 'Y' fro particular 'X' return NULL. Also give algorithm with time complexity less than O(N*N).| Report Duplicate | Flag | PURGE
Directi Algorithm
That's N*N Complexity in worst case...!!!:D
- gohil90 June 22, 2012