árvore-binária

Is there insertion method for Binary Tree Search faster than trivial?

I'm trying to solve this problem in an online judge. The problem provides N integers that must be inserted, in the given o ... printf("%d ", father[in[qi]]); } scanf("%d", &qi); printf("%d\n", father[in[qi]]); } Appreciate any help=)

Draw lines in graphical representation of binary tree

I am trying to draw a binary tree using swing and awt in java. I can already show the nodes of the tree but I am not able to ... 12); raiz.insert(raiz, 6); raiz.insert(raiz, 23); raiz.insert(raiz, 90); TreeGUI gui = new TreeGUI(raiz); }

Strictly binary tree

A Binary Search Tree is strictly binary if all nodes in the tree have 2 children or none. Implement a function that checks ... amp; estritamente_bin(a->dir); return 0; } Any suggestions and / or criticisms to improve the above implementation?

Recursive binary tree and sum of leaves

Friends I'm having trouble solving this exercise, and I don't know how to do it anymore. I got to implement the tree with rec ... of a node, it will be possible to add other nodes Recursion do not use Java type complexes (HashMap s, List s and etc)

How to create a pointer to save the address of a binary tree root and then use this address to call the root?

I have a problem with my code that is apparently simple to solve, but I still get confused with pointers. The code is to ins ... f(raiz == NULL) raiz = Criar_Raiz(expressao[j]); j++; Inserir(raiz, expressao, j, PILHA); } return raiz; }

Questions in Binary Tree in C - printing order, pre - order and post-order

I have several doubts in the functioning of binary tree in C. I have an insert, remove and print code in order, pre-order a ... irPosOrdem(pRaiz->esquerda); exibirPosOrdem(pRaiz->direita); printf("\n%i", pRaiz->numero); } }

Method that returns how many levels a Binary Tree has

I am trying to implement a binary tree for the first time but I am having difficulty in the method that returns the amount of ... ; if (atual.getNodeDireita() != null) fila.add(atual.getNodeDireita()); nivel++; } return nivel; }

Binary tree with in-order and pre-order path

I have some doubts about the path taken by this binary tree: Could you classify it as binary? Since she has knots with 3 ... ? Pre-Order: 35,80,7,11,12,15,6,0,1,2,9,3,18,8,73,13,27,71 In-Order: 12,11,0,1,2,6,9,15,7,18,8,3,80,35,13,27,71,73

How to print binary/generic trees using C?

I am suffering from the following problem: I want to print on the terminal the" drawing " of a tree. The algorithm I'm worki ... ree generic. PS3.: The addChar method simply adds The passed character as a parameter, without breaking the line at the end.

What applications for binary trees implemented in vectors?

I know the theory of binary trees, I have done the implementation of an AVL in C. I understand the functioning and applicatio ... y tree in vector, I did it perfectly only that I can not identify a utility or advantage for this type of specific structure.

Level walking in binary tree

Description of the problem I need to solve: "A walk by level in a tree, first lists the root, then all the nodes that are at ... ; imprimeNivel(no.getFilhoDireita()); } } Someone could you give me an idea of how to solve this problem?

Structure and pointers in C: Binary Tree

Hello, I'm trying to create a tree of mathematical expressions with the following logic: My expression is a string, and I h ... break; } } } return 0; } If you have another way to solve this problem, let me know!

What do you call this type of binary encoding?

Whereas I have k distinct values and use binary encoding to represent them with the minimum amount of bits, e.g. (for k=6): ... r seeing it, but I can no longer find it in the surveys, I want to delve deeper into the topic. Anyone know? Sources? Thanks.

Binary Search Tree in C

I need to develop an algorithm that finds the highest value of the sum of all nodes of the most varied possible paths of a Bi ... serir (a, 95); a = inserir (a, 10); a = inserir (a, 35); a = inserir (a, 45); printf("%d",maior_ramo(a)); return 0; }

I cannot remove leaf in binary tree

I'm trying to remove a leaf from the tree, I made a code that apparently in my head is right, only it doesn't remove the elem ... /System.out.println(arvore.getRaiz().getEsquerda().getEsquerda().getDireita().getValor()); arvore.emOrdem(); } }

How to print tree with indentation proportional to node depth in C?

I need to adjust this code so that the tree is printed with margin indentation proportional to the depth of the node, and tha ... &n3; n2.direita = &n4; n2.esquerda = &n5; n3.direita = &n6; arvbin(&n1); return 0; }

What are the differences between implementing maps by hashes or trees?

What is the advantage of implementing maps by Table hash instead of binary tree?