void printtree(word *w) {
    if (w->left != NULL)
        printtree(w->left);
    printf("%d\t%s\n", w->count, w->w);
    if (w->right != NULL)
        printtree(w->right);
}
Ejemplo n.º 2
0
void printtree (node* root)
{
  int i, j;
  if (root != NULL)
  {
    printf ("klucz: %d \n",root->record->key);
    printf ("index: %d \n",root->record->index);
    printf ("nazwa: ");
    for (i=0;i<16;i++)
    {
      printf ("%c",root->record->name[i]);
    }
    printf("\n");
    for (i=0;i<root->record->size;i++)
    {
      for (j=0;j<root->record->size;j++)
      {
        printf ("%g ",root->record->matrix[i][j]);
      }
      printf ("\n");
    }
    printf("\n");
    printtree (root->left);
    printtree (root->right);
  }
}
Ejemplo n.º 3
0
/* print all proxels of a proxel tree */
void printtree(proxel *p) {
  if (p == NULL)
    return;
  printproxel(p);
  printtree(p->left);
  printtree(p->right);
}
Ejemplo n.º 4
0
void printtree(tree* t) {
	if (!t) return;
//	t = uf_find(t);
	printf("%s", t->t);
	if (t->r) putchar('('), printtree(t->l), putchar(','), printtree(t->r), putchar(')');
	fflush(stdin);
}
Ejemplo n.º 5
0
void printtree(nsp bt)
{
  if (bt==0) return;
  printtree(bt->left);
  printf("%d\n",bt->val);
  printtree(bt->right);
}
Ejemplo n.º 6
0
void printtree(struct word* tree){
	if(tree != NULL){
		printtree(tree->leftchild);
		printf("%s:%s\n", tree->name, (tree->next == NULL) ? "" : tree->next);
		printtree(tree->rightchild);
	}
}
Ejemplo n.º 7
0
void printtree(Treeptr p) 
{
	if (p != NULL) {
		printf("character '%c' frequence is %d\n", p->c, p->count);
		printtree(p->left);
		printtree(p->right);
	}
}
void printtree(tree *node)
{
    if(node)
    {
        printf("%d",node->data);
        printtree(node->left);
        printtree(node->right);
    }
}
Ejemplo n.º 9
0
// 调试用函数,输出一棵树
void printtree(HuffmanTree * tree, int level)
{
    if (tree == NULL) return;
    for (int i=0; i<level; ++i) printf(" ");
    printf("%d\n", tree->key);
    printtree((tree->childs[0]), level+1);
    printtree((tree->childs[1]), level+1);
    fflush(stdout);
}
Ejemplo n.º 10
0
void printtree(struct node* p)
{
	if(p != NULL){
		printtree(p->left);
		printf("%d \t",p->data);
		printtree(p->right);
	}
	
}
Ejemplo n.º 11
0
void printtree(struct node *root){/*Inorder*/
	if(root==NULL) return;
	if(root->left!=NULL) printtree(root->left);
	printf(" %d ", root->val);
	if(root->right!=NULL) printtree(root->right);
	//Test tree here.
	/*if(root->left!=NULL) printf(" %d ", root->left->val);printf(" %d ", root->val);
	if(root->right!=NULL) printf(" %d ", root->right->val);printf("\n");*/
}
Ejemplo n.º 12
0
void printtree(Tree * t, int d) {
    int i;
    if (!t) return;

    printtree(t->right, d+1);
    for (i=0; i<d; i++) printf("  ");
    printf("%f(%d)\n", *(t->key), t->size);
    fflush(stdout);
    printtree(t->left, d+1);
}
Ejemplo n.º 13
0
/*
   打印树

   递归打印
   先打印左子树(比节点小的)  后打印右子树(比该节点大的)
   如 now is the time for all good men to come to the aid of their party
   >>
   aid all come for good is men now party of the their time to
 */
void printtree(struct tnode *p) {
	void printlink(struct link *p);
	if(p != NULL ) {
		printtree(p->left);
		printf("\n %s:",p->word);

		printlink(p->linkpoint);
		printtree(p->right);
	}
}
Ejemplo n.º 14
0
void printtree(struct tnode *root) {
	if(root == NULL) {
		return;
	}
	printtree(root->left);
	
	printf("%s:%d\n", root->word, root->count);
	printf("\n");
	printtree(root->right);
}
Ejemplo n.º 15
0
int
main()
{
	readseclist("seclist.local");
	gentree("", &rootsec);
	printf("#include <stdio.h>\n");
	printf("#include \"sectree.h\"\n");
	printtree("sectree", &rootsec, 0);
	printtree("sectree", &rootsec, 1);
	return 0;
}
Ejemplo n.º 16
0
void printtree(Node* node) 
{
	if (node->left != NULL) {
		printtree(node->left);
	}
	
	printf("%d ", node->value);
	
	if (node->right != NULL) {
		printtree(node->right);
	}
}
Ejemplo n.º 17
0
void print_computed(tree* t) {
	if (!t) return;
	switch (*t->t) {
	case '\\': print_computed(t->r); return;
	case '@': print_computed(t->l); return;
	default: ;
	}
	t = find(t);
	printf("%s", t->t);
	if (t->r) putchar('('), printtree(t->l), putchar(','), printtree(t->r), putchar(')');
	fflush(stdin);
}
Ejemplo n.º 18
0
Archivo: debug.c Proyecto: PoCTo/yamsh
void printtree(Tree* T, FILE* f){
    
    if (T==NULL){ return; }
    printnode(T,f);
    if ((T->left)!=NULL)
        fprintf(f,"node%p -> node%p;\n",T,(T->left));
    if ((T->right)!=NULL)
        fprintf(f,"node%p -> node%p;\n",T,(T->right));
    printtree(T->left,f);
    printtree(T->right,f);
    //fclose(f);
}
Ejemplo n.º 19
0
void printtree(struct tref *node)
{
    /* Print word tree via inorder traversal */

    if(node) {
        printtree(node->left);
        printf("%s: ", node->key);
        printlines(node->lines);
        printf("\n");
        printtree(node->right);
    }
}
Ejemplo n.º 20
0
void print_tree(trbt_tree_t *tree)
{
	if(tree->root==NULL){
		printf("tree is empty\n");
		return;
	}
	printf("---\n");
	printtree(tree->root->left, 1);
	printf("root node key:%d COLOR:%s (node:0x%08x left:0x%08x right:0x%08x)\n",tree->root->key32,tree->root->rb_color==TRBT_BLACK?"BLACK":"RED",(int)tree->root,(int)tree->root->left,(int)tree->root->right);
	printtree(tree->root->right, 1);
	printf("===\n");
}
Ejemplo n.º 21
0
static void printtree(trbt_node_t *node, int levels)
{
	int i;
	if(node==NULL)return;
	printtree(node->left, levels+1);

	for(i=0;i<levels;i++)printf("    ");
	printf("key:%d COLOR:%s (node:0x%08x parent:0x%08x left:0x%08x right:0x%08x)\n",node->key32,node->rb_color==TRBT_BLACK?"BLACK":"RED",(int)node,(int)node->parent, (int)node->left,(int)node->right);

	printtree(node->right, levels+1);
	printf("\n");
}
Ejemplo n.º 22
0
void printtree(ttree_express *r)
{
	if (r)
	{
		printtree(r->left);
		/*if (r->parent){
			puts("tem pai\n");
			printf("Pai: %c\n", r->parent->idnode);
			puts("pai exibido\n");
		}
		else puts("Sem pai\n");*/
		printf("%c\n", r->idnode);
		printtree(r->right);
	}
}
Ejemplo n.º 23
0
int main() {
	tree *t = readtree(0);
	printtree(t), puts("");
//	compute(t);
	print_computed(t), puts("");
	return 0;
}
Ejemplo n.º 24
0
int run_file() {

    Node *ptree;
    AstNode *stree;
    EmCodeObject *co;
    EmObject *retval;

    ptree = parse();
    if (ptree) {
        printtree(ptree);

        stree = ast_from_ptree(ptree);
        printstree(stree);

        co = compile_ast_tree(stree);
        printobj((EmObject *)co, stdout);


        INCREF(&nulobj);
        retval = run_codeobject(co, NULL, &nulobj);

        if (retval)
            DECREF(retval);

        freetree(ptree);
        freestree(stree);

    }
    fclose(source.fp);

    return 1;
}
Ejemplo n.º 25
0
void printSubNodes(Node *n, int level, char* name) {
	printf ("%*c %s\n", level, ' ', name);
	if(n->subnodes == 0) return;
	int i;
	for(i = 0; i < n->subnodes; i++)
		printtree (n->node_data.nodes[i], level+1);
}
Ejemplo n.º 26
0
int main(int argc, char *argv[])
{
    int i;
    root = 0;
    for (i = 1; i < argc; i++)
        insert(&root, atoi(argv[i]));
    printtree(root);
}
int main()
{
    tree *NODE = NULL;
    NODE= insert(&NODE,5);
    NODE= insert(&NODE,3);
    NODE= insert(&NODE,8);
    printtree(NODE);
    freeMemory(NODE);
    return 0;
}
Ejemplo n.º 28
0
void printtree( token *tok ) {
    if( !tok ) {
        return;
    }
    printtok(tok);
    if( tok->lhs ) {
        printf(" (");
        printtree(tok->lhs);
        printf(")");
    }
    if( tok->rhs ) {
        printf(" (");
        printtree(tok->rhs);
        printf(")");
    }
    if( tok->next ) {
        printf(", ");
        printtree(tok->next);
    }
}
Ejemplo n.º 29
0
static int printtree(struct cache_set *cs, struct node *n, int d) {
    int i;
    int ab = 0;
    if (n == NULL) return 0;
    if(n == cs->root) { ptree("--------------------------\n"); }
    ab |= printtree(cs, n->right, d+1);
    if(n->right) {
	if(cmp(n->digest, n->size, n->right->digest, n->right->size) >= 0) {
	    for (i=0; i<d; i++) ptree("        ");
	    ptree("^^^^ %lld >= %lld\n", n->digest[1], n->right->digest[1]);
	    ab = 1;
	}
    }
    for (i=0; i<d; i++) ptree("        ");
    ptree("%08x(%02u)\n", n->digest[1]>>48, n - cs->data);
    if(n->left) {
	if(cmp(n->digest, n->size, n->left->digest, n->left->size) <= 0) {
	    for (i=0; i<d; i++) ptree("        ");
	    ptree("vvvv %lld <= %lld\n", n->digest[1], n->left->digest[1]);
	    ab = 1;
	}
    }
    if(d){
	if(!n->up) {
	    ptree("no parent!\n");
	    ab = 1;
	} else {
	    if(n->up->left != n && n->up->right != n) {
		ptree("broken parent\n");
		ab = 1;
	    }
	}
    } else {
	if(n->up) {
	    ptree("root with a parent!\n");
	    ab = 1;
	}
    }
    ab |= printtree(cs, n->left, d+1);
    return ab;
}
Ejemplo n.º 30
0
static int lp_printtree (lua_State *L) {
  TTree *tree = getpatt(L, 1, NULL);
  int c = lua_toboolean(L, 2);
  if (c) {
    lua_getfenv(L, 1);  /* push 'ktable' (may be used by 'finalfix') */
    finalfix(L, 0, NULL, tree);
    lua_pop(L, 1);  /* remove 'ktable' */
  }
  printktable(L, 1);
  printtree(tree, 0);
  return 0;
}