Mercurial > hg > GearsTemplate
changeset 159:f2c77b0761fc
fix rb_stack.cbc
author | mir3636 |
---|---|
date | Wed, 16 Nov 2016 21:29:01 +0900 |
parents | 3fdb3334c7a9 |
children | 73c393f0dca3 db647f7ed2f6 |
files | src/parallel_execution/rb_tree.cbc |
diffstat | 1 files changed, 53 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/rb_tree.cbc Wed Nov 16 20:21:07 2016 +0900 +++ b/src/parallel_execution/rb_tree.cbc Wed Nov 16 21:29:01 2016 +0900 @@ -5,6 +5,59 @@ extern enum Relational compare(struct Node* node1, struct Node* node2); +typedef struct Stack { + union Data* stack; + union Data* data; + union Data* data1; + enum Code whenEmpty; + + enum Code clear; + enum Code push; + enum Code pop; + enum Code pop2; + enum Code isEmpty; + enum Code get; + enum Code get2; + enum Code next; +} Stack; + +typedef struct Tree { + union Data* tree + enum Code put; + enum Code get; + enum Code remove; + enum Code next; +} Tree; + +typedef struct Traverse { + struct Node* root; + struct Node* current; + struct Node* previous; + struct Node* newNode; + struct Node* parent; + struct Node* grandparent; + struct Stack* nodeStack; + int result; +} Traverse; + +typedef struct RotateTree { + enum Code next; + struct Traverse* traverse; + struct Tree* tree; +} RotateTree; + +typedef struct Node { + int key; // comparable data segment + union Data* value; + struct Node* left; + struct Node* right; + // need to balancing + enum Color { + Red, + Black, + } color; +} Node; + void printTree1(union Data* data) { struct Node* node = &data->node; if (node == NULL) {