So i am building a library as project that covers not all but most of the data structures and i found myself with this problem: At rows 40 and 41 (rows 3 and 4 of method containsKeyAux) it says “The method compareTo(Comparable) is undefined for the type Comparable” and this blows my mind cause the method compareTo is actually defined
Tag: tree
Change node values to their heights in a binary tree
My task is to change the values of nodes to their heights in a binary tree. By the condition of the task, you need to change all the values in 1 pass of the tree, but you can violate this condition …
Simple dynamic JTree-based S3 bucket/object chooser example
Before writing my own custom implementation, I have been googling for a complete example of a simple tree-like JTree/JDialog that allows me to dynamically load and expand the contents of a S3 bucket or sub-S3-object-keys. In other words, I don’t want to recursively prefetch all the objects from different buckets beforehand and populate a JTree. The reason is that there
How to query a Hierarchical Category tree entity with undefined depth
I have created a hierachy structure or a tree structure for a shopping site using springboot. My problem is how to query such a structure when looking for a specific product and its parents: This is what i have done, any pointers on what i need to do on the entity to achieve this structure and also how i can
Trying to print top view of a tree using two if statements
Problem Statement You are given a pointer to the root of a binary tree. Print the top view of the binary tree. You only have to complete the function. My Code: The two if statements are executed every time the function is called, but I need only one of them to execute. I tried switch but its giving constant expression
Java Tree to represent filesystem (files/dir) from list of paths
I’ve a list of paths like this So from this list of paths (Stings) I need to crete a Java Tree structure that has folders as nodes and files as leaf (there wont be empty folders as leaf). What I need I think is the add method where I pass to them a String (path of the file) and it
Parsing an arithmetic expression and building a tree from it in Java
I needed some help with creating custom trees given an arithmetic expression. Say, for example, you input this arithmetic expression: The result tree should look like: I have some custom classes to represent the different types of nodes, i.e. PlusOp, LeafInt, etc. I don’t need to evaluate the expression, just create the tree, so I can perform other functions on