algorithm - Very specific tree traversal method -
algorithm - Very specific tree traversal method -
i've been trying develop/find specific way traverse tree structure. familiar 2~3 used tree traversal methods, , don't know plenty jargon search web, please forgive me if i'm asking obvious or basic.
i have next tree construction (not binary tree):
assume come in tree @ node "aaa". want method traverse underlying nodes using top downwards method first.
however after this, want method move tree, , deal top downwards below except part did before it.
i want maintain doing until reaches top node , finishes.
a specific requirement cannot "skip" nodes. entering, or returning node has done either it's parent or child. before entering node register whether visitor traversing or downwards tree (this necessary info visitors). can raise flags whether entering tree first time, or whether passing entry node again. visitor may not visit node twice except entry node, may pass multiple times long re_entry flag raised. ideally not want maintain track of list of nodes passed in past. have tried few different approaches
case global_spread: { if ( pvisitor->lastvisited == null ) pvisitor->visitdirection = entry; pvisitor->visit(this); ( uint32 i(0) ; < children.size() ; += 1 ) { pvisitor->visitdirection = down; children[i]->accept(pvisitor); } break; }
this piece of code of course of study nil else perform top downwards traversal of below starting node. problems arise when tried add together code bump visitor tree , top downwards traversal there. calling parent->accept(pvisitor) before visiting children not produce desired results. calling parent->accept(pvisitor) after visiting children produce desired results in case of entry node. every other node cause problems.
i wondering if had experience these types of tree traversal methods, , whether have plenty info kind of traversal @ all. 1 time again of import not maintain track of lists of visited items. @ best can maintain track in function node visited. perhaps known , documented traversal method don't know name of.
thanks in advance!
this code seems implement request. key working visiting first node (whatever is) considered up
operation. print_tree()
, print_preorder()
functions implement normal preorder traversal of tree; they're used show info construction in right shape. dfs_traversal()
, dfs_traverse()
functions implement special dfs traversal. test code tests 2 specific examples (the aaa
, a
nodes), , exhaustive check of traversal every node in tree.
#include <stdio.h> enum { max_child = 2 }; enum { = 1, downwards = 2 }; typedef struct node node; struct node { char name[8]; int number; node *parent; node *child[max_child]; }; static node data[] = { { "a", 0, 0, { &data[ 1], &data[ 2], }, }, { "aa", -3, &data[0], { &data[ 3], &data[ 4], }, }, { "ab", +3, &data[0], { &data[ 5], &data[ 6], }, }, { "aaa", -4, &data[1], { &data[ 7], &data[ 8], }, }, { "aab", +4, &data[1], { &data[ 9], &data[10], }, }, { "aba", -4, &data[2], { &data[11], &data[12], }, }, { "abb", +4, &data[2], { &data[13], &data[14], }, }, { "aaaa", 0, &data[3], { 0, 0, }, }, { "aaab", +5, &data[3], { 0, 0, }, }, { "aaba", -5, &data[4], { 0, 0, }, }, { "aabb", +5, &data[4], { 0, 0, }, }, { "abaa", -5, &data[5], { 0, 0, }, }, { "abab", +5, &data[5], { 0, 0, }, }, { "abba", -5, &data[6], { 0, 0, }, }, { "abbb", +5, &data[6], { 0, 0, }, }, }; enum { num_nodes = sizeof(data) / sizeof(data[0]) }; static void visit(node *node, int up_down) { printf("%4s: ", up_down == ? "up" : "down"); printf(" %5s [%2d] n = %p; p = %p\n", node->name, node->number, (void *)node, (void *)node->parent); } static void print_tree(node *node) { if (node != 0) { visit(node, down); (int = 0; < max_child; i++) print_tree(node->child[i]); } } static void print_preorder(const char *tag, node *node) { printf("tree starting %s:\n", tag); print_tree(node); } static void dfs_traverse(int up_down, node *node, node *skip) { if (node != 0 && node != skip) { visit(node, up_down); (int = 0; < max_child; i++) dfs_traverse(down, node->child[i], skip); if (node->parent != 0 && up_down == up) dfs_traverse(up, node->parent, node); } } static void dfs_traversal(const char *tag, int up_down, node *node, node *skip) { printf("dfs starting %s\n", tag); dfs_traverse(up_down, node, skip); } int main(void) { node *aaa = &data[3]; node *root = &data[0]; print_preorder("root", root); print_preorder("aaa", aaa); dfs_traversal("aaa", up, aaa, 0); dfs_traversal("root", up, root, 0); (int = 0; < num_nodes; i++) dfs_traversal(data[i].name, up, &data[i], 0); homecoming 0; }
example output tree starting root: down: [ 0] n = 0x10dbab040; p = 0x0 down: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 down: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 tree starting aaa: down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 dfs starting aaa up: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 up: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 up: [ 0] n = 0x10dbab040; p = 0x0 down: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 dfs starting root up: [ 0] n = 0x10dbab040; p = 0x0 down: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 down: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 dfs starting up: [ 0] n = 0x10dbab040; p = 0x0 down: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 down: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 dfs starting aa up: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 up: [ 0] n = 0x10dbab040; p = 0x0 down: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 dfs starting ab up: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 up: [ 0] n = 0x10dbab040; p = 0x0 down: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 dfs starting aaa up: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 up: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 up: [ 0] n = 0x10dbab040; p = 0x0 down: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 dfs starting aab up: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 up: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 up: [ 0] n = 0x10dbab040; p = 0x0 down: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 dfs starting aba up: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 up: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 up: [ 0] n = 0x10dbab040; p = 0x0 down: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 dfs starting abb up: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 up: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 up: [ 0] n = 0x10dbab040; p = 0x0 down: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 dfs starting aaaa up: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 up: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 up: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 up: [ 0] n = 0x10dbab040; p = 0x0 down: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 dfs starting aaab up: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 up: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 up: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 up: [ 0] n = 0x10dbab040; p = 0x0 down: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 dfs starting aaba up: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 up: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 up: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 up: [ 0] n = 0x10dbab040; p = 0x0 down: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 dfs starting aabb up: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 up: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 up: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 up: [ 0] n = 0x10dbab040; p = 0x0 down: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 dfs starting abaa up: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 up: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 up: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 up: [ 0] n = 0x10dbab040; p = 0x0 down: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 dfs starting abab up: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 up: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 up: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 up: [ 0] n = 0x10dbab040; p = 0x0 down: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 dfs starting abba up: abba [-5] n = 0x10dbab248; p = 0x10dbab130 up: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 up: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 up: [ 0] n = 0x10dbab040; p = 0x0 down: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0 dfs starting abbb up: abbb [ 5] n = 0x10dbab270; p = 0x10dbab130 up: abb [ 4] n = 0x10dbab130; p = 0x10dbab090 down: abba [-5] n = 0x10dbab248; p = 0x10dbab130 up: ab [ 3] n = 0x10dbab090; p = 0x10dbab040 down: aba [-4] n = 0x10dbab108; p = 0x10dbab090 down: abaa [-5] n = 0x10dbab1f8; p = 0x10dbab108 down: abab [ 5] n = 0x10dbab220; p = 0x10dbab108 up: [ 0] n = 0x10dbab040; p = 0x0 down: aa [-3] n = 0x10dbab068; p = 0x10dbab040 down: aaa [-4] n = 0x10dbab0b8; p = 0x10dbab068 down: aaaa [ 0] n = 0x10dbab158; p = 0x10dbab0b8 down: aaab [ 5] n = 0x10dbab180; p = 0x10dbab0b8 down: aab [ 4] n = 0x10dbab0e0; p = 0x10dbab068 down: aaba [-5] n = 0x10dbab1a8; p = 0x10dbab0e0 down: aabb [ 5] n = 0x10dbab1d0; p = 0x10dbab0e0
algorithm recursion data-structures tree traversal
Comments
Post a Comment