Mercurial > hg > CbC > old > akasha
diff src/insert_verification/main.c @ 16:3acaadc0a60c
Enumerate all insetion patterns
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 20 Mar 2016 23:39:31 +0900 |
parents | d6d6e075b498 |
children | 1034102aff1e |
line wrap: on
line diff
--- a/src/insert_verification/main.c Sun Mar 20 22:47:53 2016 +0900 +++ b/src/insert_verification/main.c Sun Mar 20 23:39:31 2016 +0900 @@ -96,28 +96,28 @@ __code duplicateIteratorElem(struct Context* context, struct Allocate* allocate, struct Iterator* iter) { // All elements in iterator must be unique. - struct IterElem *oldElem = iter->previousDepth->head; + struct IterElem *oldElem = iter->previousDepth->head->next; struct IterElem *newElem = iter->head; - while (newElem->next != NULL) { // FIXME: simple implementation O(n^2) oldElem = oldElem->next; newElem = newElem->next; } - if (oldElem == iter->previousDepth->head) { + if (oldElem->val == iter->previousDepth->iteratedValue) { newElem->next = iter->head; - iter->last = newElem; + iter->last = iter->head; goto duplicateTree_stub(context); // meta } else { struct IterElem* dup = context->heap; allocate->size = sizeof(struct IterElem); allocator(context); - dup->val = oldElem->next->val; + dup->val = oldElem->val; newElem->next = dup; - goto duplicateIteratorElem_stub(context); // meta + goto duplicateIteratorElem_stub(context); + //goto meta(context, DuplicateIterElem); // meta } } @@ -137,7 +137,7 @@ showTrace(finishedIter); // FIXME: show trace - while (finishedIter->head == finishedIter->last) { + while (finishedIter->last == finishedIter->head) { if (finishedIter->previousDepth == NULL) { goto meta(context, ShowTree); // all enumerations finished. }