You guy check this solution. It is expected to be run in
O(n lg n) for random permutation in average time. For
worst case, I think we can improve it for that.
Let's do an example firstly.
7 3 4 1 2 6 5 8
For *1*, it self is a block. Let's count the blocks containing *1* firstly.
If a block
These are the steps for the O(n^2) solution
n=length of A
for each subarray A[i,j] where ji
min=min(A[i,j])
max=max(A[i,j])
if(max - min==size (A[i,j]) print A[i,j]
min[A[i,j]]=min( A[j], min(A[i,j-1])
similar one for max
Note:
A[i,j] = A[i],A[i+1]A[j]
I was
check this if
How To Install Dreamweaver CS3 In Ubuntu
Hardyhttp://eaziweb.blogspot.com/2009/12/how-to-install-dreamweaver-cs3-in.html
Regards
Shahzeb Farooq Chohan
Software Engineer
Cogilent Solutions
Get your new Email address!
Grab the Email name you've always wanted before someone
check this if
How To Install Dreamweaver CS3 In Ubuntu
Hardyhttp://eaziweb.blogspot.com/2009/12/how-to-install-dreamweaver-cs3-in.html
Regards
Shahzeb Farooq Chohan
Software Engineer
Cogilent Solutions
Get your new Email address!
Grab the Email name you've always wanted before
Hi, Well
Recaman's sequence is defined by: a(0) = 0
a(k) = a(k-1) -
k, k0, a(k) new term in series or else a(k-1) + k
So sequence is 0, 1, 3,6, 2, 7, 13, 20, 12, 21, 11, 22, 10,
23,
My approach used memoization using map in c++
On Dec 2, 6:45 am, Vinoth Kumar vinoth.ratna.ku...@gmail.com wrote:
These are the steps for the O(n^2) solution
n=length of A
for each subarray A[i,j] where ji
min=min(A[i,j])
max=max(A[i,j])
if(max - min==size (A[i,j]) print A[i,j]
min[A[i,j]]=min( A[j],
On Dec 2, 10:42 am, Geoffrey Summerhayes sumr...@gmail.com wrote:
It's a binary tree, [ 7 3 4 1 2 6 5 8] has children
[ 7 3 4 1 2 6 5] and [ 3 4 1 2 6 5 8], all the way
down to [ 7 3] [3 4] [4 1] ...
If you start at the bottom keeping track of min and max
for each node, if max-min == node