Questions tagged [treenode]

The base element of a hierarchical tree-like data structure.

Trees are hierarchical data structures that represent undirected acyclic graphs. A tree is therefore composed of connected nodes.

One specific node is the root of the tree. The root node is connected to several nodes (sometimes called children), each of these being the root of a subtree, and so-on. A node of a tree that does not have any children is called a leaf. All nodes of the tree are connected directly or indirectly to the root.

Treenodes are usually recursive datastructures.

See also:

Specific usages:

  • In .Net framework a TreeNode is a node in TreeView UI control that displays tree-like objects.
  • In Java a TreeNode is an interface that nodes of a JTree UI control that displays tree-like objects.
630 questions
-1
votes
2 answers

JTree without leaf

Is it possible to make a JTree without leaf? If it is possible then please tell me way. I want to convert these highlighted leafs as the folder or parent. If you want any thing else apart from it then please let me know.
Java_Alert
  • 1,159
  • 6
  • 24
  • 50
-1
votes
3 answers

searching a binary tree

I'm writing an iterative function to search a binary tree for a certain value. This is localized to signed ints until I get into how to genericize classes. Assume that my class is BinarySearchTree, and it has a pointer to the root node of the tree.…
jkeys
  • 3,803
  • 11
  • 39
  • 63
-2
votes
1 answer

WPF C# - Bind tab selection to treeView selection

How do I bind a tabItem IsSelected property to a treeView Node selection via index or reference? I want to be able to click on a treenode that will auto select a tabItem within a tabControl
Andy_
  • 19
  • 6
-2
votes
2 answers

What does Type * foo() mean/return?

I am implementing a Binary Search Tree. And it so happens one of my sources have a function written such that: Node * BST_Insert(Node *root, int val) { //Body } I already know that a pointer is a variable which contains the address of another…
user15939950
-2
votes
1 answer

I have to put the hyphen on the parent node when a child is selected with primeng

This is Typescript //DICHIARATIONS AN CODE Ngonint--> ngOnInit() { if(this.title === "Create"){ this.dataProfilo = {} this.dataProfilo.function = []; this.service.getTree().subscribe( (res) => { …
A. S. Bush
  • 11
  • 6
-2
votes
1 answer

Python Unit test for least common ancestor gives TypeError: 'int' object is not callable

When running the file it gives TypeError: 'int' object is not callable. I'm just learning unit test in python. Can't figure out why and what's the wrong with me? file lca.py class Node: def __init__(self, value): self.value = value …
user7149801
  • 65
  • 1
  • 14
-2
votes
1 answer

Iterate into childs if variable still null

I have a foreach method like this: TreeNode selectedNode = null; foreach (TreeNode tn in allNodes) { if (selectedNode != null) continue; var designNodes = tn.Nodes; …
Jonathan
  • 601
  • 9
  • 26
-2
votes
2 answers

warning C4715: not all control paths return a value c++

i made two functions, one to find and return smallest key in a red - black tree and the other one returns a pointer to a particular node with that node's key as input.These functions work fine with all nodes except the nodes with the highest key and…
T-man
  • 3
  • 1
  • 3
-2
votes
2 answers

TreeNode cannot be cast to java.lang.Comparable?

i am trying to write a method that returns the parent for the specified node (BST), i keep getting this: TreeNode cannot be cast to java.lang.Comparable Any suggestions on how to fix this? Thanks! Here is the method (is located almost at the end!)…
Kurt16
  • 35
  • 2
  • 10
-2
votes
5 answers

coping data to a node value in c gives segmentation fault but malloc removes it

I have the below program for inserting node in bst #include #include struct node { int key; struct node * left; struct node * right; }; struct node * insert(struct node *,int); int main( int argc, const char…
-2
votes
3 answers

Find root from any node in a BST

How can I find the root of a binary search tree from any given node? More specifically, when should I stop while going through the ancestors from any given node? Is there any function in java to get the root? Please help me.
Neel
  • 9,913
  • 16
  • 52
  • 74
-2
votes
2 answers

How do I write a TreeNode to a PrintStream of a given File?

I have to write a method write(Printstream p) where p has been defined as new PrintStream(new File(QUESTION_FILE). I don't even really need to know how to go directly from a TreeNode into the PrintStream, just mainly how to put Strings line…
-3
votes
3 answers

Can I make a binary search tree with this?

I've made BSTs before. Can I use this to make a BST without modifications? template class binary_tree_node { public: private: Item data_field; binary_tree_node *left_ptr; binary_tree_node *right_ptr; }; I tried making…
neuromancer
  • 53,769
  • 78
  • 166
  • 223
-4
votes
1 answer

C program compiles but won't print out the test cases in the main method

The whole point of my C code is to insert string nodes in alphabetical order. Here is my code.... #include #include #include typedef struct node { char * word; struct node * left; struct node *…
-4
votes
1 answer

How to build TreeView object using nodes of another TreeView object?

I have treeView1, I need to create treeview2 using nodes of treeView1 when treeNode.Text == myString. So I have to traverse all nodes of treeView1, and if treeNode.Text == myString, then I should add this node to treeView2, and if any of this…
Romz
  • 1,437
  • 7
  • 36
  • 63
1 2 3
41
42