I continue to work on this project as an interest and keep coming back to it ...
What I'm trying to create is an algorithm for listing the sets of values of a binary Fibonacci value tree:

An algorithm that I would use to print permutations of this tree:
- The print root value (Result: ([root 0] = 5))
- go down left [left 1]
- Type the new left node [left 1] and the right number sibling node (Result: ([left 1] 3, [right 1] 2))
- If the right brother node [right 1] has child nodes, go right node [right 1], listing its values with it sibling left node [left 1] (Result: [left 1] 3, [left 3] 1, [right 3] 1)
- Go down to the left child [left 2] as step 2
- node [left 2] 2 sibling node [right 2] 1 [left 1]; node. , , , , : ([left 2] 2, [right 2] 1, [right 1] 2), ([left 2] 2, [right 2] 1, [left 3] 1, [right 3] 1))
- , ,
root. , - .
, , , :
([root 0] 5), ([left 1] 3, [right 1] 2), ([left 1] 3, [left 3] 1, [right 3] 1), ([left 2] 2, [right 2] 1, [right 1] 2), ([left 2] 2, [right 2] 1, [left 3] 1, [right 3] 1)
, , . , , , .
- ? .
`FibTree`` Class`:
FibTree ( ):
class FibTree {
public:
class Node {
public:
int data;
Node const* left;
Node const* right;
Node const* parent;
int n;
int level;
int index;
Node (void);
};
Node const* root;
FibTree (int);
Node const* getRoot(void);
void startWriteSets(Node const* root);
private:
static Node* buildTree( int n, int level = 0, int i = 1, Node* parent = NULL );
void writeSets(std::vector<Node const*> &setsList, Node const* cur);
CPP FibTree ( ):
FibTree::FibTree(int n) {
this->root = buildTree( n );
};
FibTree::Node const* FibTree::getRoot(void) {
return this->root;
}
void FibTree::startWriteSets(Node const* root) {
std::vector<Node const*> setsList;
std::cout << root->data;
writeSets(setsList, root);
}
FibTree::Node* FibTree::buildTree( int n, int level, int i, Node* parent ) {
Node* thisNode = new Node();
thisNode->n = n;
thisNode->level = level;
thisNode->index = i;
thisNode->parent = parent;
if (n < 2) {
thisNode->left = NULL;
thisNode->right = NULL;
thisNode->data = n;
return thisNode;
} else {
thisNode->left = buildTree( n - 1 , level + 1, i*2, thisNode );
thisNode->right = buildTree( n - 2, level + 1, i*2+1, thisNode );
thisNode->data = thisNode->left->data + thisNode->right->data;
return thisNode;
}
}
void FibTree::writeSets(std::vector<Node const*> &setsList, Node const* cur) {
std::vector<Node const*>::iterator nodeIterator;
for (nodeIterator = setsList.begin();
nodeIterator != setsList.end(); nodeIterator++) {
std::cout << *nodeIterator->data;
}
std::cout << cur->left->data;
std::cout << cur->right->data;
setsList.push_back(cur->left);
writeSets(setsList,cur->right);
setsList.pop_back();
}
FibTree::Node::Node()
: data( 0 ),
left( NULL ),
right( NULL ),
parent( NULL ),
n( 0 ),
level( 0 ),
index( 0 )
{
};
std::cout << *nodeIterator->data; void FibTree::writeSets:
_error: '' * nodeIterator. __gnu_cxx:: __ normal_iterator < _Iterator, _Container > :: operator- > _Iterator = const FibTree:: Node **, Container = std::vector > ', non-class' const FibTree:: Node *
, , !