baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:
i have a question for you. It is more of a theoretical question, question requiring a tip rather then the actual code. so the problem is i have this bit-vector of size N:
and what i need to figure out is the position of an overall minimum given two indexes i,j. so if this is the vector and 1 marks the point of increase and 0 marks the point of decrease in some not known value,then the vector can be converted into :Example: A: 0 1 2 3 4 5 6 7 8 9 10 11 1 0 0 1 0 1 0 0 0 1 0 0
Essentially what i have here is a Cartesian tree. and this means that there are only certain types of indexes that can be picked:if i start counting from 10 then B[0] = A[0]+10 = 11 B: 0 1 2 3 4 5 6 7 8 9 10 11 11 10 9 10 9 10 9 8 7 8 7 6
so given two indexes B[1],B[7] I wolud like to figure out the min value between them which in my example is 8 on the position B[7].i,j = B[1],B[7] (A[1],A[7]) i,j != B[6],B[10] -> then there are two min positions (B[1] and B[7]) +and this cannot be....
current solutions all include dealing with this problem by precomputing the Sparse table and then do constant time picks-> and this is really fast, but in my case i cannot create an array type B nor a classical Sparse table since i'm bound by dealing only with bits, meaning, all i have and can work with are the arrays of type A (bit-vector). so my current solution is to divide the A into chunks and then evaluate if the overall min of the chunk is greater or smaller then the overall min of the previous chunk and then create another bit-vector reflecting the relative overall growth or decay and then do this in a tree fashion until i reach the symmetrical min (here what i have is a binary tree). problem with this approach is that it runs rather slow since i cannot do constant picks like in the Sparse table and construction complexity increases from n -> n log n. since i'm running this on big datasets, putting one such structure in memory (using 64 bit OS) memory requirements grow up to 300 GB of ram (i tested it the other day on the university cluster :))
so my question is , does anyone have an idea on how to do this type of searches without building the actual tree atop the initial bit-vector (A) like i'm doing now.
Cheers
baxy
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: bit-vector > global minimum
by BrowserUk (Patriarch) on Oct 03, 2011 at 17:23 UTC | |
by baxy77bax (Deacon) on Oct 03, 2011 at 18:05 UTC | |
by BrowserUk (Patriarch) on Oct 03, 2011 at 19:04 UTC | |
by baxy77bax (Deacon) on Oct 03, 2011 at 20:10 UTC | |
by BrowserUk (Patriarch) on Oct 03, 2011 at 22:48 UTC | |
| |
by Marshall (Canon) on Oct 03, 2011 at 22:18 UTC | |
Re: bit-vector > global minimum
by choroba (Cardinal) on Oct 03, 2011 at 16:44 UTC | |
by dwm042 (Priest) on Oct 03, 2011 at 17:17 UTC | |
by choroba (Cardinal) on Oct 03, 2011 at 17:26 UTC | |
by baxy77bax (Deacon) on Oct 03, 2011 at 17:20 UTC |