ok yes this is the first level that i probably didn't explain as well as i shpuld. but that is what i was talking about and complaining that this runs in O(X) time where X= |A[i,j]|
. Now if you would preprocess this one more time to get from :
1 | 001010 | 0
1 | 0 | 0 > in this array you need to do 3 jumps (for
+my $p ( $s .. $e ))
#the reduction follows from the Cartesian tree that follows from the b
you would need to do only 3 jumps and so on and so on. and this iterative preprocessing will in the end place a tree on top of my vector. and searching such binary tree is faster. So what i need is a better preprocessig of my initial 100101000100. so i can save it in a Sparse table and in just 2 comparisons (steps) do what you achieved here in 7 (X)steps. Or if something totally crazy is suggested that will blow my mind straight down-under :) I will not complain :)
Thank You !!