Questions tagged [tree]

A tree is a widely-used data structure that emulates a hierarchical tree-like structure with a set of linked nodes.

Filter by
Sorted by
Tagged with
0 votes
0 answers
30 views

how do I count for every index a unique value. so I can make an data structure tree

i have a data set with column names and I have to make an tree in python for these column names. I have everything in an list: ['HoPE', 'FA', 'exp', 'TX', 'C2', 'TR2', 'AR4'] ['HoPE', 'FA', 'exp', '...
yade acem's user avatar
0 votes
1 answer
33 views

Height of Polish Notation Tree (prefix) with Binary and Unary Nodes

I need to get the depth of a Polish notation tree (prefix) with binary and unary nodes. The solution here can work by simply reversing the expression string beforehand; however, if the prefix ...
Edward Finkelstein's user avatar
0 votes
1 answer
44 views

Inserting a tree-like dataset into MySQL using a python script

Hello I am very new to MySQL. I am facing some issues to inserting a large "tree-like" data into my database. DATA: I have a tree-like data of various topics, subtopics, sub-subtopics and so ...
sigma's user avatar
  • 227
0 votes
1 answer
23 views

Get Name of Nodes Attributes of an XML file

I'm trying to get names of attributes nodes of an XML file..i'm able to read nodes and attributes value but not names. In this xml example: <?xml version="1.0" encoding="UTF-8"?&...
Marco Giglio's user avatar
1 vote
1 answer
17 views

R: Tree graph with vertex information in plot

I'm trying to plot my data, which has a hierarchical structure, and I would like to visualize it using a tree structure. This is my attempt thus far: library(igraph) df <- data.frame("...
Helen's user avatar
  • 545
0 votes
1 answer
24 views

How to make product categories tree?

I use fastapi, postgresDB, I need to create an endpoint that returns tree of product categories class CategoryTree(BaseModel): id: int name: str children: list[CategoryTree] | None = None ...
Vadim Rudenkov's user avatar
0 votes
1 answer
106 views

Messages concerning MFC-CTreeCtrl

At the moment we have created some classes which are derived from CTreeCtrl. There are problems with TVN_ITEMEXPANDING that is not sent at all. By trial and error we found out that we had to use the ...
Graphman's user avatar
0 votes
1 answer
20 views

PyQt - cannot add buttons to tree children [duplicate]

I create a tree-view that should look like: parent1 path branch [button] path branch [button] ... I create the tree like this def create_tree(self,containerWidget): self.repo_tree = ...
pf12345678910's user avatar
0 votes
0 answers
6 views

Using @ag-grid-community/angular version <28 with Angular 16 in order to use the tree data feature in grid

Would like to know if anyone has found a way to use ag grid older versions with Angular 16. We cannot update ag-grid to >28 since we need to use the tree data structure which is available only till ...
Meghana G's user avatar
-1 votes
0 answers
17 views

java swt tree expand/collapse arrows without indentation

I want to remove indentation from the arrows which appears for the expandable/collapsable rows in java swt tree. if the rows are expandable then the arrows appear when this expandable row has nested ...
Satya's user avatar
  • 7
0 votes
0 answers
8 views

Vue2 lib for a tree table structure

Do you guys could suggest me a lib to build a treetable structure (e.g Windows Explorer Folders Structure) for Vue.js 2.5.16? I'm absolutely newer with this technology, im not even a frontend ...
diego_nobrega's user avatar
0 votes
0 answers
20 views

How to create custom tree structure in Angular with reactive form?

From API response need to create the custom tree. Each node has one dropdown which options are 'No' & 'Yes'. All nodes has one button at end of the each node. If I select the first root node value ...
Neelan VelPaari's user avatar
0 votes
0 answers
18 views

Java swt tree padding

I am able to add padding to the left of treeitems, but i don't know how to add padding to the top and bottom of the treeitems. I want to increase/decrease the padding of tree items. This padding ...
Satya's user avatar
  • 7
0 votes
1 answer
20 views

traversing a object tree, find an item and return the object

prerequisites: Each branch in the tree can have any number of further branches. I tried to traverse the tree usinge a recursion. When the object is found it is returned to the higher-level instance. ...
foschi's user avatar
  • 3
0 votes
1 answer
28 views

Height of RPN Tree with Binary and Unary Nodes

I know there is a way to get the depth of a pure binary RPN tree (e.g. here), but I am struggling to find out how to get the depth of a tree with binary and unary nodes. For this problem, I am for the ...
Edward Finkelstein's user avatar
-3 votes
0 answers
22 views

I have problem and i'm beginner, this is my problem i try to get the high of 'tree' and its 3 but before i get the return i get Exception NullPointer [duplicate]

'Trying to get high of this tree but i got Exception' private int high(Node root){ if (rootIsEmpty(root)) return 0; return 1 + Math.max( high(root.leftChild), ...
Omar's user avatar
  • 1
-1 votes
1 answer
35 views

In docker can't use tree command, get error: /bin/sh: 52: tree: not found

I'm using docker, I want to use tree command, but I get error: # tree -L 1 /bin/sh: 52: tree: not found # whereis tree tree: # apt install tree Reading package lists... Done Building dependency tree ...
Tom's user avatar
  • 461
0 votes
0 answers
18 views

Change row height in SWT tree

I have tree, i want to change the row height of that tree. I have tried adding listener, SWT.MeasureItem and EraseItem as well, but still the row height is not changing. There is the function in ...
Satya's user avatar
  • 7
2 votes
1 answer
55 views

How to plot a tree in Python with node labels?

I would like to reproduce the following figure using any tool in Python: (This is a part of figure 5 page 75 in [^Furnival1974] that I created using Inkscape). I would like not only to reproduce this ...
Michael Baudin's user avatar
0 votes
1 answer
13 views

Rename tree tip labels by removing parts of character string

Edit: clarification I'm looking to rename the tip.labels of my nwk tree in R. An example of the current labels is: AB177299.1 Uncultured bacterium gene for 16S rRNA, clone: ODP1251B1.3 but I'd just ...
Geomicro's user avatar
  • 315
0 votes
0 answers
11 views

How do I display files (.txt, .pdfs, .word, etc) in my directory program. JAVA

I am having trouble displaying the files in directories when I display it on my program and get an exception. I am using a tree structure to try to import my files and display them. Exception in ...
Fernando Romo's user avatar
0 votes
1 answer
14 views

Renaming nwk tree tip labels based on character strings and a factors file

I'm looking to rename the tip labels of my nwk tree (colwell_tree) using a taxonomy file (colwell_taxonomy). I tried identifying the old tip labels to the taxonomy file and assign new labels from the ...
Geomicro's user avatar
  • 315
0 votes
1 answer
21 views

Minimum number of nodes in AVL tree given that the shallowest leaf is at level k

My teacher asked this quesion in class, to find the minumum number of nodes in an AVL tree where the depth of the nearest leaf is K. But there is a catch, like we have to do it in O(1) time and not a ...
PiTheta1729's user avatar
0 votes
1 answer
47 views

Why do we return root?

I have always just blindly returned the root during these tree recursion problems without asking why. I have an idea that its about keeping the consitency or order of the tree. What is return root ...
Rahul's user avatar
  • 11
0 votes
3 answers
112 views

how to parse a file in bash, awk... for linking program and subprogram in a more efficient way

I have the need to generate a tree view for a list of program and subprogram we actually use. we have a working script right now (in ksh), but it's take a very long time to achieve (between 3 and 4 ...
yo Ni's user avatar
  • 17
0 votes
1 answer
22 views

Headless CMS as part of wider tech ecosystem

I have a question about architecture with a CMS that I haven't really found a good resource for, so thought I'd throw it to the community. My org is hoping to shift our current content tree structure ...
Max's user avatar
  • 1
-3 votes
1 answer
72 views

flatten a singly linked list

I have this tree structure, where each node has a next and child pointer. I am trying to flatten such a tree to a linked list where each node only uses the next pointer. Example input: 1 --> 2 --&...
Vamsi Krishna's user avatar
0 votes
1 answer
57 views

Leetcode: Binary Tree Paths

I'm solving the following leetcode problem: Given the root of a binary tree, return all root-to-leaf paths in any order. A leaf is a node with no children. Input: root = [1,2,3,null,5] Output: [&...
Some Name's user avatar
  • 8,566
1 vote
0 answers
49 views

Why recursion is not handling state of variable [duplicate]

This is a code to find all the paths of tree from root to leaf. Input class Node { constructor (val) { this.val = val; this.left = null; this.right = null; } } ...
amit's user avatar
  • 61
2 votes
1 answer
70 views

C++ CTreeCtrl, how to edit only one item of a tree

Is there any way to make editable CTreeCtrl items that are fit in exact condition, not all of tree items. If I set TVS_EDITLABELS, all tree items can be changed by right button click CViewTree ...
Nika_Rika's user avatar
  • 607
0 votes
1 answer
231 views

min-heap order for the following

Consider the min-heap [13, 24, 32, 32, 41, 38, 50, 48, 40] built by repeatedly inserting values into an empty heap. Suppose the last value inserted was 24. What was the heap structure before this ...
NISAR AHMED's user avatar
0 votes
0 answers
17 views

How to Perform Bottom-Up Parsing for a Given CFG and Input String?

I am currently working on a project that involves parsing arithmetic expressions using a context-free grammar (CFG). I have the following CFG for generating arithmetic expressions: E -> E + T E -&...
Orion Blaze's user avatar
1 vote
0 answers
10 views

Drawing majority ordered Newick trees using Ete3

Is there a way to draw trees using Ete3 so that the node with the largest value is always set to the bottom? And if there are more than two branches, nodes are in descending order. See an example ...
xosxos's user avatar
  • 187
0 votes
0 answers
72 views

User-defined items in MFC CTreeCtrl

At the moment we are using Stingray controls in our project. The following image shows a tree with various sized icons. Now we want to replace the Stingray controls by MFC Controls. Is there a ...
Graphman's user avatar
0 votes
0 answers
12 views

PrimeReact Tree - Drag and Drop

I use PrimeReact tree and they implement the ability to drag and drop in the same tree. I want that during mouse move I will be able to check if it's ok to drop the item or not and if it's not ok to ...
arnon_e's user avatar
0 votes
0 answers
14 views

what's the computational complexity of finding maximum common subconfiguration between several subgraph?

given a set of subgraphs {G1,G2...,Gn} and another set {K1,K2...,Km}. Each G or K is a acyclic tree. Total vertices number in {G1,G2...,Gn} and {K1,K2...,Km} are equal. So, what's the computational ...
WeiRP's user avatar
  • 1
0 votes
0 answers
35 views

What is the algorithm in this code of Tree Constructor?

The input is array of string ["(1,2)","(10,2)"] import ast def TreeConstructor(strArr): # code goes here if len(strArr) == 0: return "true" nodes = {} ...
Kerolous Momtaz's user avatar
1 vote
1 answer
55 views

How to filter tree-like named object?

I have a tree object like below, and I need to search through it. I know there's already some answers on topics like this here, but they are, unfortunately, do not comply with my structure. const tree ...
Drun555's user avatar
  • 13
0 votes
0 answers
40 views

Postgresql Recursive Return Qualifier

I'm working with hierarchies in Postgresql for the first time. Is it possible to qualify a node given the state of its children? Take this example case: create table Org ( id int primary key UNIQUE,...
Dan Lamet's user avatar
0 votes
1 answer
132 views

Implement add-leaf, a Scheme procedure that takes in a tree instance t and a number x

Implement add-leaf, a Scheme procedure that takes in a tree instance t and a number x. This procedure will return a new tree where for each non-leaf node in the tree, append a new leaf with the label ...
Proteus Yi's user avatar
0 votes
0 answers
8 views

How to retrieve the index of data for the defaultCollapseIcon in MUI tree?

TreeView <TreeView multiSelect defaultCollapseIcon={ <ArrowDropDownIcon fontSize="large" onClick={e => { e....
jan's user avatar
  • 57
1 vote
2 answers
43 views

Recursion Stack Trace explanation using javascript

// Recursive javascript program for level // order traversal of Binary Tree // Class containing left and right child of current // node and key value class Node { constructor(val) { this.data = ...
Jagan's user avatar
  • 4,659
-2 votes
1 answer
28 views

This code is solving Tree Sum problem without executing a return statement in a recursive function?

I am trying to solve GeeksforGeeks problem Sum Tree: Given a Binary Tree. Return true if, for every node X in the tree other than the leaves, its value is equal to the sum of its left subtree's value ...
Baljit Singh's user avatar
0 votes
0 answers
26 views

Create tree like structure on flat ag-grid table without using tree structure of ag-grid

I have some heirachical data I don't want to display using a tree data structure offered by ag-grid, but on the flat table itself using cell-renderer want to showcase it as a tree. I am able to mange ...
shweta konde's user avatar
0 votes
1 answer
21 views

How to prevent overlay of TreeSelect Checkbox auto collapse when click child node

In the website document of primeNg https://primeng.org/treeselect#checkbox First I click Documents checkbox -> Home checkbox When I click Document -> Home Second I click Invoices checkbox Result ...
Tri Thức Đinh's user avatar
2 votes
1 answer
25 views

Difficulty maintaining a tree structure with Riverpod (Flutter)

I've been learning Flutter recently for one of my personal projects. For the project, I need to implement a file system within the app in which each folder acts as a Node with optional child Nodes. ...
CHBC's user avatar
  • 21
-3 votes
0 answers
18 views

why def dfs(x, l) and def dfs(x, l=[]) It's different? [duplicate]

n = int(input()) tree = [ [0]*9 for i in range(n) ] for i in range(n): a = list(map(int, input().split())) if a[1] != -1: tree[a[0]][a[1]] = 1 if a[2] != -1: tree[a[0]][a[2]...
willy's user avatar
  • 1
-1 votes
0 answers
14 views

d3 tree hide some children of a node

Using the d3-tree I want to hide one or more children of a node while the rest of the children should still be visible. I my attempts I ended up with an exception somewhere in the d3 code. I know how ...
OlManVBA's user avatar
0 votes
0 answers
47 views

what is the meaning of order in B-tree?

here is the question, from my tutorial PDF. Insert the keys 10,50,30,70,90,25,40,95,45,48,60,80,35,75,43,32,78,65,55,68,99,92,96,98,94 in this order in an initially empty B-tree of order 5. my ...
zhs's user avatar
  • 23
2 votes
2 answers
59 views

Creating dict groupby from two dataframes

I want to achieve the following when Back is equal to 1. Logic is the following: 8582 is the main node level is 1 and has 4 sub node (8584,8593,8585,8586) and each of those sub nodes have sub nodes ...
Gogo78's user avatar
  • 1

1
2 3 4 5
334