splay v1/p3; decent cond

This commit is contained in:
Gregory Burd 2024-03-31 21:45:16 -04:00
parent bfc5c76b30
commit b62fd4bf6a

View file

@ -589,22 +589,22 @@ void __attribute__((format(printf, 4, 5))) __skip_diag_(const char *file, int li
} \
\
/** \
* -- __skip_rebalance_ TODO \
* -- __skip_rebalence_ TODO \
* \
*/ \
static void __skip_rebalance_##decl(decl##_t *slist, size_t len, decl##_node_t **path, size_t par_sum) \
static void __skip_rebalence_##decl(decl##_t *slist, size_t len, decl##_node_t **path, size_t par_sum) \
{ \
size_t i; \
double asc_cond, dsc_cond; \
\
/* Moving backwards along the path... */ \
for (i = 1; i <=len; i++) { \
for (i = 1; i < len; i++) { \
if (par_sum > 0) { \
/* check the decent condition: \
par_sum <= hits total / (2 ^ (height of head - height of node)) \
*/ \
dsc_cond = pow(2.0, slist->slh_head->field.sle_height - path[i]->field.sle_height); \
if (0 && par_sum <= dsc_cond) { \
if (par_sum <= dsc_cond) { \
/* reduce height by one, change forward pointer */ \
path[i - 1]->field.sle_next[i] = path[i]->field.sle_next[i]; \
path[i]->field.sle_next[i] = slist->slh_tail; \
@ -614,7 +614,7 @@ void __attribute__((format(printf, 4, 5))) __skip_diag_(const char *file, int li
par_sum + node_hits > hits total / (2 ^ (height of head - height of node - 1)) \
*/ \
asc_cond = pow(2.0, slist->slh_head->field.sle_height - path[i]->field.sle_height - 1); \
if (+ path[i]->field.sle_hits > asc_cond) { \
if (+path[i]->field.sle_hits > asc_cond) { \
} \
} \
} \
@ -650,7 +650,7 @@ void __attribute__((format(printf, 4, 5))) __skip_diag_(const char *file, int li
if (__skip_compare_nodes_##decl(slist, elm, n, slist->slh_aux) == 0) { \
path[0] = elm; \
path[0]->field.sle_hits++; \
__skip_rebalance_##decl(slist, len, path, par_sum); \
__skip_rebalence_##decl(slist, len, path, par_sum); \
} \
return len; \
} \