\r
{ int answ;\r
if (!getBit(tree,pos)) return -1; // no answer\r
- pot--;\r
pos = (pos<<1)+1;\r
if (pos >= n) return 0; // when n is not a power of 2, missing leaves\r
+ pot--;\r
if ((p>>pot) == 0) // p goes left\r
{ answ = nextLarger(tree,n,p&~(1<<pot),pos,pot);\r
if (answ != -1) return answ;\r
// Naively implemented by kim\r
\r
unsigned int countResult(results R) {\r
- unsigned int result = 0;\r
+ unsigned int result = -1;\r
int i = 0;\r
while ( i != -1 && i < R.n) {\r
result ++; \r