binary-tree
Tree building function from precalculated tree
I am building a binary tree. The binary tree is pre-built in a file and I need to construct it. Due to the way it is structured, I read the tree into an array. Each tree nodes look something like this[详细]
2023-03-09 16:22 分类:问答binary search tree - adding nodes
I built a function that needs to add a node to a binary search tree that is sorted by its ID (moviecode = id) but it doesn\'t work right. can you help me figure out whats wrong with the code?[详细]
2023-03-09 00:28 分类:问答Finding the common ancestor in a binary tree
This question was asked to me in an interview: I have a binary tree and I have to find the common ancestor (parent) given two random nodes of that tree.I am also given a pointer to the root node.[详细]
2023-03-09 00:23 分类:问答StackOverflowError with a binary tree
Have the following insertion method for a left child - right sibling tree - seems to be causing a StackOverflowError at the line that called addpage again within the private version of the method. Can[详细]
2023-03-08 02:33 分类:问答Java Binary Tree Cloning Problem
I have a Java Binary Tree with the below specification and I need to clone it. public class Item { private final String value;[详细]
2023-03-06 22:27 分类:问答Combining Trees and Nodes, value unaccessible
i\'m experimenting with trees and nodes and I having trouble. I have typedef struct nodo { int cuenta; int fondo;[详细]
2023-03-06 06:58 分类:问答How to store big binary tree
How to store big binary trees (about thousands in depth). We tried to store in database, in table with rows开发者_StackOverflow: elem, parent, left_child, right_child[详细]
2023-03-06 06:38 分类:问答BinarySearchTree searching speed efficiency
import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Random;[详细]
2023-03-06 05:53 分类:问答How to finding first common ancestor of a node in a binary tree?
Following is my algorithm to find first common ancestor. But I don’t know how to calculate it time complexity, can anyone help?[详细]
2023-03-05 15:04 分类:问答Replace the node's value to be the sum of all its descendents
private void sumNode(TNode node) { int sum = 0; if (node == null) return; sumNode(node.getLeft()); sumNode(node.getRight());[详细]
2023-03-05 06:59 分类:问答