Mercurial > hg > Papers > 2017 > atton-master
view paper/src/getMinHeight.c @ 28:36ce493604fb
Add akasha result
author | atton <atton@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 23 Jan 2017 18:41:23 +0900 |
parents | 243d8dc4a292 |
children |
line wrap: on
line source
__code getMinHeight_stub(struct Context* context) { goto getMinHeight(context, &context->data[Allocate]->allocate, &context->data[AkashaInfo]->akashaInfo); } __code getMinHeight(struct Context* context, struct Allocate* allocate, struct AkashaInfo* akashaInfo) { const struct AkashaNode* akashaNode = akashaInfo->akashaNode; if (akashaNode == NULL) { allocate->size = sizeof(struct AkashaNode); allocator(context); akashaInfo->akashaNode = (struct AkashaNode*)context->data[context->dataNum]; akashaInfo->akashaNode->height = 1; akashaInfo->akashaNode->node = context->data[Tree]->tree.root; goto getMaxHeight_stub(context); } const struct Node* node = akashaInfo->akashaNode->node; if (node->left == NULL && node->right == NULL) { if (akashaInfo->minHeight > akashaNode->height) { akashaInfo->minHeight = akashaNode->height; akashaInfo->akashaNode = akashaNode->nextAkashaNode; goto getMinHeight_stub(context); } } akashaInfo->akashaNode = akashaInfo->akashaNode->nextAkashaNode; if (node->left != NULL) { allocate->size = sizeof(struct AkashaNode); allocator(context); struct AkashaNode* left = (struct AkashaNode*)context->data[context->dataNum]; left->height = akashaNode->height+1; left->node = node->left; left->nextAkashaNode = akashaInfo->akashaNode; akashaInfo->akashaNode = left; } if (node->right != NULL) { allocate->size = sizeof(struct AkashaNode); allocator(context); struct AkashaNode* right = (struct AkashaNode*)context->data[context->dataNum]; right->height = akashaNode->height+1; right->node = node->right; right->nextAkashaNode = akashaInfo->akashaNode; akashaInfo->akashaNode = right; } goto getMinHeight_stub(context); }